How do I do database transactions with psycopg2/python db api?

后端 未结 3 1726
无人及你
无人及你 2020-12-07 23:29

Im fiddling with psycopg2 , and while there\'s a .commit() and .rollback() there\'s no .begin() or similar to start a transaction , or so it seems ? I\'d expect to be able t

3条回答
  •  失恋的感觉
    2020-12-07 23:48

    I prefer to explicitly see where my transactions are :

    • cursor.execute("BEGIN")
    • cursor.execute("COMMIT")

提交回复
热议问题