If I have multiple cursors (each in a different thread, for example) generated from the same DB connection, does a commit on one cursor (e.g. in Python: cursor.execute(‘COMMIT’)) affect transactions in progress on another cursor within the same connection? If so, should I always only have one cursor per DB connection, in order to avoid cross-cursor issues like this? (Also, if you know, does this also apply to Google Cloud SQL?)
Thanks in advance for any advice.
probably.
MySQLdbspecifies athreadsafety– attribute of 1, which means you shouldn’t share connections (and therefore cursors) on multiple threads without manual synchronisazion.you should better use some form of connection pooling.