diff options
author | Roman Podolyaka <roman.podolyaka@gmail.com> | 2013-06-15 15:38:02 +0300 |
---|---|---|
committer | Roman Podolyaka <roman.podolyaka@gmail.com> | 2013-06-15 16:54:50 +0300 |
commit | a1ceae2ed3b3996d5b8a554c201cf668d6d17f27 (patch) | |
tree | 29cf8f549a2f756d4c3aa1e00418517fd965199f /lib/sqlalchemy/dialects/postgresql/psycopg2.py | |
parent | 9d3e2206363d819ad334d7893c700b861fdc5b57 (diff) | |
download | sqlalchemy-pr/7.tar.gz |
Add AUTOCOMMIT isolation level support for psycopg2pr/7
One can use this to emit statements, which can not be
executed within a transaction (e. g. CREATE DATABASE):
from sqlalchemy import create_engine
eng = create_engine('postgresql://test:test@localhost/test')
conn = eng.connect().execution_options(isolation_level='AUTOCOMMIT')
conn.execute('CREATE DATABASE test2;')
Fixes issue #2072.
Diffstat (limited to 'lib/sqlalchemy/dialects/postgresql/psycopg2.py')
-rw-r--r-- | lib/sqlalchemy/dialects/postgresql/psycopg2.py | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/sqlalchemy/dialects/postgresql/psycopg2.py b/lib/sqlalchemy/dialects/postgresql/psycopg2.py index fcc1946ff..c7f9f0187 100644 --- a/lib/sqlalchemy/dialects/postgresql/psycopg2.py +++ b/lib/sqlalchemy/dialects/postgresql/psycopg2.py @@ -350,6 +350,7 @@ class PGDialect_psycopg2(PGDialect): def _isolation_lookup(self): extensions = __import__('psycopg2.extensions').extensions return { + 'AUTOCOMMIT': extensions.ISOLATION_LEVEL_AUTOCOMMIT, 'READ COMMITTED': extensions.ISOLATION_LEVEL_READ_COMMITTED, 'READ UNCOMMITTED': extensions.ISOLATION_LEVEL_READ_UNCOMMITTED, 'REPEATABLE READ': extensions.ISOLATION_LEVEL_REPEATABLE_READ, |