summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/dialects/postgresql/asyncpg.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2021-11-26 10:17:38 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2021-11-29 13:46:23 -0500
commitdb85d28a857945ce021e27a187a14999eeb5c89e (patch)
tree3e402d745aa1d01a51198154ddda25fe96296056 /lib/sqlalchemy/dialects/postgresql/asyncpg.py
parent5eb407f84bdabdbcd68975dbf76dc4c0809d7373 (diff)
downloadsqlalchemy-db85d28a857945ce021e27a187a14999eeb5c89e.tar.gz
provide connectionfairy on initialize
This is so that dialect methods that are called within init can assume the same argument structure as when they are called in other places; we can nail down the type of object as well. This change seems to mostly impact the isolation level routines in the dialects, as these are called during initialize() as well as on established connections. these methods can now assume a non-proxied DBAPI connection object in all cases, as it is commonly required that attributes like ".autocommit" are set on the object which don't work well in a proxied situation. Other changes: * adds an interface for the "connectionfairy" concept called PoolProxiedConnection. * Removes ``Connectable`` superclass of Connection. ``Connectable`` was originally meant to provide for the "method which accepts connection or engine" theme. As this pattern is greatly reduced in 2.0 and Engine no longer extends from it, the ``Connectable`` superclass doesnt serve any real purpose. Leading from that, to set this in I also applied pep 484 annotations to the Dialect base, and then in the interests of seeing some of the typing information show up in my IDE did a little bit for Engine, Connection and others. I hope that it's feasible that we can add annotations to specific classes and attributes ahead of when we actually try to mass-populate the whole library. This was the original spirit of pep-484 that we can apply annotations gradually. I do of course want to try to do a mass-populate although i think even in that case we will end up doing a lot of manual work anyway (in particular for the changes here which are distinct from what the stubs have). Fixes: #7122 Change-Id: I5dd7fbff8a7ae520a81c165091af12a6a68826db
Diffstat (limited to 'lib/sqlalchemy/dialects/postgresql/asyncpg.py')
-rw-r--r--lib/sqlalchemy/dialects/postgresql/asyncpg.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/sqlalchemy/dialects/postgresql/asyncpg.py b/lib/sqlalchemy/dialects/postgresql/asyncpg.py
index 1fdb46b6f..4951107bc 100644
--- a/lib/sqlalchemy/dialects/postgresql/asyncpg.py
+++ b/lib/sqlalchemy/dialects/postgresql/asyncpg.py
@@ -871,11 +871,11 @@ class PGDialect_asyncpg(PGDialect):
"SERIALIZABLE": "serializable",
}
- def get_isolation_level_values(self, dbapi_conn):
+ def get_isolation_level_values(self, dbapi_connection):
return list(self._isolation_lookup)
- def set_isolation_level(self, connection, level):
- connection.set_isolation_level(self._isolation_lookup[level])
+ def set_isolation_level(self, dbapi_connection, level):
+ dbapi_connection.set_isolation_level(self._isolation_lookup[level])
def set_readonly(self, connection, value):
connection.readonly = value