title: Bulk update PostgreSQL from Python dict
body: <p>In an existing PostgreSQL table, I would like to <code>UPDATE</code> several existing columns with values from a dictionary lookup (see dict below). Somewhat like described in this <a href="http://tapoueh.org/blog/2013/03/15-batch-update" rel="nofollow">nice blog post</a>. However, I can't figure out how to do that with a Python dictionary. Here comes the terrible pseudo-code:</p>
  
  <pre><code>d = {10:'chair', 11:'table', 12:'lamp', 
      20:'english ivy', 21:'peace lily', 22:'spider plant'}
  
  curs.execute("""
      UPDATE my_table t
      SET furniture = %(t.furniture)s,
      SET plant = %(t.plant)s""",
      d)
  </code></pre>
  
  <p>The <strong>original</strong> table would look somewhat like this:</p>
  
  <pre><code>gid | furniture | plant
  -----------------------
   0  |    10     |  21
   1  |    11     |  20
   ...
  </code></pre>
  
  <p><strong>After</strong> the operation it should look like this:</p>
  
  <pre><code>gid | furniture |    plant
  -----------------------------
   0  |   chair   | peace lily
   1  |   table   | english ivy
   ...
  </code></pre>
  
  <p>Is this possible or will I have to loop through the table?</p>