diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2022-07-13 11:02:37 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2022-07-13 11:02:37 -0400 |
commit | a3a3299b5b9728a432ba900754047844ecfb98d6 (patch) | |
tree | 35a1c5eb7777ca0cc8859e780444d2ec64c003df /lib/sqlalchemy/dialects/postgresql/base.py | |
parent | ff1086f019efe32c099a5b5dad1160c95c10db62 (diff) | |
download | sqlalchemy-a3a3299b5b9728a432ba900754047844ecfb98d6.tar.gz |
document create_engine.isolation_level for PG
Change-Id: I06eaede9e021eb0790929168e9bedb0c8b58140a
References: #8252
Diffstat (limited to 'lib/sqlalchemy/dialects/postgresql/base.py')
-rw-r--r-- | lib/sqlalchemy/dialects/postgresql/base.py | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/lib/sqlalchemy/dialects/postgresql/base.py b/lib/sqlalchemy/dialects/postgresql/base.py index 394c64360..56bc02b23 100644 --- a/lib/sqlalchemy/dialects/postgresql/base.py +++ b/lib/sqlalchemy/dialects/postgresql/base.py @@ -147,7 +147,7 @@ Transaction Isolation Level --------------------------- Most SQLAlchemy dialects support setting of transaction isolation level -using the :paramref:`_sa.create_engine.execution_options` parameter +using the :paramref:`_sa.create_engine.isolation_level` parameter at the :func:`_sa.create_engine` level, and at the :class:`_engine.Connection` level via the :paramref:`.Connection.execution_options.isolation_level` parameter. @@ -165,9 +165,7 @@ To set isolation level using :func:`_sa.create_engine`:: engine = create_engine( "postgresql+pg8000://scott:tiger@localhost/test", - execution_options={ - "isolation_level": "REPEATABLE READ" - } + isolation_level = "REPEATABLE READ" ) To set using per-connection execution options:: @@ -179,6 +177,11 @@ To set using per-connection execution options:: with conn.begin(): # ... work with transaction +There are also more options for isolation level configurations, such as +"sub-engine" objects linked to a main :class:`.Engine` which each apply +different isolation level settings. See the discussion at +:ref:`dbapi_autocommit` for background. + Valid values for ``isolation_level`` on most PostgreSQL dialects include: * ``READ COMMITTED`` @@ -189,10 +192,10 @@ Valid values for ``isolation_level`` on most PostgreSQL dialects include: .. seealso:: - :ref:`postgresql_readonly_deferrable` - :ref:`dbapi_autocommit` + :ref:`postgresql_readonly_deferrable` + :ref:`psycopg2_isolation_level` :ref:`pg8000_isolation_level` |