title: psycopg insert timestamp without formatting it
body: <p>I have a timestamp that I'm trying to insert into postgres using psycopg, but I'm having trouble getting things to work out and I think it's because I'm trying to use python's string formatting to drop the date into the right position. I have something like this</p>
  
  <pre><code>values = {"timestamp": u'2016-03-01T12:40:45.236697', ...}
  "INSERT...VALUES(...{timestamp}...)".format(**values)
  </code></pre>
  
  <p>Postgres is tripping up on the "T", throwing a syntax error. </p>
  
  <p>I've tried converting the string to a datetime object, but then the formatting just puts it back into a string that looks like this</p>
  
  <pre><code>2016-03-01 12:40:45.236697
  </code></pre>
  
  <p>and postgres hangs up on the space. I've tried to use PGs to_timestamp(), but PG hangs up in the same places. I'll end up with a few of these and I'm trying to avoid breaking this out into several strings that I have to concat back together. Does anyone have any ideas? I can manipulate the original timestamp string if I need to, but I can't figure out what that string should look like to make PG happy. </p>
  
  <p>Thanks in advance </p>