title: Insert python list into Postgres database
body: <p>I am having trouble in formatting the list for insertion using psycopg.
  Here is a sample of code i am trying to do.
  Basically I am just reading data from one table and trying to insert it into another table.</p>
  
  <p>Code:</p>
  
  <pre><code>cur.execute("""select data from \"Table1\" where lat=-20.004189 and lon=-63.848004""")
  rows = cur.fetchall()
  print rows
  cur.execute("""INSERT INTO \"%s\" (data) VALUES (ARRAY%s)""" % (args.tableName,rows)))
  </code></pre>
  
  <p>The result returned by first select query is like this:</p>
  
  <pre><code>[([6193, 3975, 4960, 5286, 3380, 970, 3328, 3173, 2897, 2457, 2443, 2674, 2172, 2740, 3738, 4907, 3691, 4234, 3651, 3215],)]
  </code></pre>
  
  <p>When I try to insert this into another table I get the following format error.</p>
  
  <pre><code>   cur.execute(cur.mogrify("""INSERT INTO \"%s\" (data) VALUES (%s)""" % (args.tableName,rows)))
  psycopg2.ProgrammingError: syntax error at or near "["
  LINE 1: INSERT INTO "DUMMY1km" (data) VALUES ([([6193, 3975, 4960, 5...
  </code></pre>
  
  <p>I tried cur.mogrify, but it does not seem to help.</p>
  
  <p>Please let me know if anyone has a work around for this issue.</p>
  
  <p>Thanks
  Adi</p>