Compatibility with psycopg2 2.9+ (#1970)

the autocommit = True is ignored in the `with connection` block
This commit is contained in:
Alexander Kukushkin
2021-06-17 14:29:10 +02:00
committed by GitHub
parent 2d504a4f0a
commit e5bfd4f5ee
+5 -4
View File
@@ -40,7 +40,8 @@ class Connection(object):
@contextmanager
def get_connection_cursor(**kwargs):
with psycopg2.connect(**kwargs) as conn:
conn.autocommit = True
with conn.cursor() as cur:
yield cur
conn = psycopg2.connect(**kwargs)
conn.autocommit = True
with conn.cursor() as cur:
yield cur
conn.close()