title: Updating a table from another table with multiple columns in sqlalchemy
body: <p>I want to update multiple columns of one table according to other multiple columns of another table in SQLAlchemy. I'm using SQLite when testing it, so I can't use the `UPDATE table1 SET col=val WHERE table1.key == table2.key" syntax.</p>
  
  <p>In other words, I'm trying to create this sort of update query:</p>
  
  <pre><code>UPDATE table1 
  SET 
     col1 = (SELECT col1 FROM table2 WHERE table2.key == table1.key), 
     col2 = (SELECT col2 FROM table2 WHERE table2.key == table1.key)
  </code></pre>
  
  <p>In SQLAlchemy:</p>
  
  <pre><code>select_query1 = select([table2.c.col1]).where(table1.c.key == table2.c.key)
  select_query2 = select([table2.c.col2]).where(table1.c.key == table2.c.key)
  session.execute(table.update().values(col1=select_query1, col2=select_query2))
  </code></pre>
  
  <p>Only I'd like to do the query only once instead of twice, unless SQLite and MySQL are smart enough not to make that query twice themselves.</p>