title: Python, SQL: How to update multiple rows and columns in a single trip around the database?
body: <p>Hello StackEx community.
  I am implementing a relational database using SQLite interfaced with Python. My table consists of 5 attributes with around a million tuples.
  To avoid large number of database queries, I wish to execute a single query that updates 2 attributes of multiple tuples. These updated values depend on the tuples' <code>Primary Key</code> value and so, are different for each tuple.</p>
  
  <p>I am trying something like the following in <code>Python 2.7</code>:</p>
  
  <pre><code>stmt= 'UPDATE Users SET Userid (?,?), Neighbours (?,?) WHERE Username IN (?,?)'
  cursor.execute(stmt, [(_id1, _Ngbr1, _name1), (_id2, _Ngbr2, _name2)])
  </code></pre>
  
  <p>In other words, I am trying to update the rows that have <code>Primary Keys</code> <code>_name1</code> and <code>_name2</code> by substituting the <code>Neighbours</code> and <code>Userid</code> columns with corresponding values. The execution of the two statements returns the following error:</p>
  
  <pre><code>OperationalError: near "(": syntax error
  </code></pre>
  
  <p>I am reluctant to use <code>executemany()</code> because I want to reduce the number of trips across the database. 
  I am struggling with this issue for a couple of hours now but couldn't figure out either the error or an alternate on the web. Please help.</p>
  
  <p>Thanks in advance.</p>