summaryrefslogtreecommitdiff
path: root/django/db/backends/postgresql/psycopg_any.py
diff options
context:
space:
mode:
authorFlorian Apolloner <florian@apolloner.eu>2022-12-12 09:40:08 +0100
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2022-12-12 10:36:42 +0100
commit1d90c9b1132482d446ca8375c151e894002c9e8d (patch)
tree3ce0bf7b9abea96d1b8669b0181f39c4f5a047af /django/db/backends/postgresql/psycopg_any.py
parent2f38f7b8f9bd65905dc6bec4f3e2a30b5da8e338 (diff)
downloaddjango-1d90c9b1132482d446ca8375c151e894002c9e8d.tar.gz
Refs #33308 -- Added psycopg_any.IsolationLevel.
Diffstat (limited to 'django/db/backends/postgresql/psycopg_any.py')
-rw-r--r--django/db/backends/postgresql/psycopg_any.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/django/db/backends/postgresql/psycopg_any.py b/django/db/backends/postgresql/psycopg_any.py
index 8e0d170867..83e8a9f4d3 100644
--- a/django/db/backends/postgresql/psycopg_any.py
+++ b/django/db/backends/postgresql/psycopg_any.py
@@ -1,3 +1,5 @@
+from enum import IntEnum
+
from psycopg2 import errors, extensions, sql # NOQA
from psycopg2.extras import DateRange, DateTimeRange, DateTimeTZRange, Inet # NOQA
from psycopg2.extras import Json as Jsonb # NOQA
@@ -6,6 +8,13 @@ from psycopg2.extras import NumericRange, Range # NOQA
RANGE_TYPES = (DateRange, DateTimeRange, DateTimeTZRange, NumericRange)
+class IsolationLevel(IntEnum):
+ READ_UNCOMMITTED = extensions.ISOLATION_LEVEL_READ_UNCOMMITTED
+ READ_COMMITTED = extensions.ISOLATION_LEVEL_READ_COMMITTED
+ REPEATABLE_READ = extensions.ISOLATION_LEVEL_REPEATABLE_READ
+ SERIALIZABLE = extensions.ISOLATION_LEVEL_SERIALIZABLE
+
+
def _quote(value, connection=None):
adapted = extensions.adapt(value)
if hasattr(adapted, "encoding"):