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
The BEGIN
with python standard DB API is always implicit. When you start working with the database the driver issues a BEGIN
and after any COMMIT
or ROLLBACK
another BEGIN
is issued. A python DB API compliant with the specification should always work this way (not only the postgresql).
You can change this setting the isolation level to autocommit with db.set_isolation_level(n)
as pointed by Alex Martelli.
As Tebas said the begin is implicit but not executed until an SQL is executed, so if you don't execute any SQL, the session is not in a transaction.