title: Postgres/psycopg2 - Inserting array of strings
body: <p>I'm using Postgres 9 and Python 2.7.2 along with psycopg2 and am trying to insert an array of string values with properly escaped quotation marks. Sample:</p>
  
  <pre><code>metadata = {"Name": "Guest", "Details": "['One', 'Two', 'Three']"}
  
  cur.execute("insert into meta values ('%s');" % metadata)
  </code></pre>
  
  <p>which throws the exception:</p>
  
  <pre><code>psycopg2.ProgrammingError: syntax error at or near "One"
  LINE 1: "Details": "['One...
                        ^
  </code></pre>
  
  <p>I've also tried using Postgres' E to escape along with backslashes, but haven't found the correct combination yet. Ideas?</p>