On Thu, Jun 1, 2017 at 12:10 AM, Jon Ribbens <jon+use...@unequivocal.eu> wrote: > On 2017-05-31, DFS <nos...@dfs.com> wrote: >> On 5/31/2017 6:26 AM, Jon Ribbens wrote: >>> Yes, this is indeed a problem with DB-API - you have to keep *two* >>> objects around all the time (the connection and the cursor) and pass >>> them to functions, etc, when in any sensible system as used by all >>> other languages you would only need to pass the connection. >> >> You only need to pass the cursor. > > ... unless you want to call .commit() or .rollback(). > Which is where we came in.
Technically you CAN commit from the cursor: cur.connection.commit() Proof: >>> import psycopg2 >>> conn = psycopg2.connect("") >>> cur = conn.cursor() >>> cur.connection is conn True ChrisA -- https://mail.python.org/mailman/listinfo/python-list