attempt to streamline/improve execution options flow
Issue #2770
resolved
notes:
diff --git a/lib/sqlalchemy/dialects/firebird/kinterbasdb.py b/lib/sqlalchemy/dialects/firebird/kinterbasdb.py
index c8d8e98..42d3766 100644
--- a/lib/sqlalchemy/dialects/firebird/kinterbasdb.py
+++ b/lib/sqlalchemy/dialects/firebird/kinterbasdb.py
@@ -99,9 +99,11 @@ class FBDialect_kinterbasdb(FBDialect):
cursor.execute(statement, parameters or [
def do_rollback(self, dbapi_connection):
+ # TODO: look in dbapi_connection._memos here for instructions
dbapi_connection.rollback(self.retaining)
def do_commit(self, dbapi_connection):
+ # TODO: look in dbapi_connection._memos here for instructions
dbapi_connection.commit(self.retaining)
def create_connect_args(self, url):
diff --git a/lib/sqlalchemy/dialects/oracle/cx_oracle.py b/lib/sqlalchemy/dialects/oracle/cx_oracle.py
index e013799..58a0227 100644
--- a/lib/sqlalchemy/dialects/oracle/cx_oracle.py
+++ b/lib/sqlalchemy/dialects/oracle/cx_oracle.py
@@ -829,6 +829,7 @@ class OracleDialect_cx_oracle(OracleDialect):
def do_prepare_twophase(self, connection, xid):
result = connection.connection.prepare()
+ # TODO: use .memo for this
connection.info['cx_oracle_prepared'](])
) = result
def do_rollback_twophase(self, connection, xid, is_prepared=True,
@@ -840,11 +841,13 @@ class OracleDialect_cx_oracle(OracleDialect):
if not is_prepared:
self.do_commit(connection.connection)
else:
+ # TODO: use .memo for this
oci_prepared = connection.info['cx_oracle_prepared']('cx_oracle_prepared')
if oci_prepared:
self.do_commit(connection.connection)
def do_recover_twophase(self, connection):
+ # TODO: use .memo for this
connection.info.pop('cx_oracle_prepared', None)
dialect = OracleDialect_cx_oracle
diff --git a/lib/sqlalchemy/engine/base.py b/lib/sqlalchemy/engine/base.py
index 2d9f3af..a87f308 100644
--- a/lib/sqlalchemy/engine/base.py
+++ b/lib/sqlalchemy/engine/base.py
@@ -70,6 +70,10 @@ class Connection(Connectable):
self._has_events = _has_events or engine._has_events
self._echo = self.engine._should_log_info()
+
+ # TODO: see if the same dialect hook below can also get fired
+ # for this, or maybe at the engine level and dialects can add a listener
+ # perhaps
if _execution_options:
self._execution_options =\
engine._execution_options.union(_execution_options)
@@ -200,6 +204,9 @@ class Connection(Connectable):
"""
c = self._clone()
c._execution_options = c._execution_options.union(opt)
+
+ # TODO: see if a dialect hook can be made here,
+ # do this in that hook
if 'isolation_level' in opt:
c._set_isolation_level()
return c
diff --git a/lib/sqlalchemy/pool.py b/lib/sqlalchemy/pool.py
index dcf3d9e..2d8756f 100644
--- a/lib/sqlalchemy/pool.py
+++ b/lib/sqlalchemy/pool.py
@@ -322,6 +322,11 @@ class _ConnectionRecord(object):
exec_once(self.connection, self)
pool.dispatch.connect(self.connection, self)
+ # TODO: add a new collection here per checkout
+ @util.memoized_property
+ def _memos(self):
+ return {} # clear/remove on checkin
+
@util.memoized_property
def info(self):
return {}
@@ -409,9 +414,13 @@ def _finalize_fairy(connection, connection_record, pool, ref, echo):
if connection_record is not None:
connection_record.fairy = None
+
+ # TODO: change this, make some kind of symmetric system
+ # where dialects can put any number of setup/teardown things
if connection_record.finalize_callback:
connection_record.finalize_callback(connection)
del connection_record.finalize_callback
+
if pool.dispatch.checkin:
pool.dispatch.checkin(connection, connection_record)
pool._return_conn(connection_record)
@@ -465,6 +474,7 @@ class _ConnectionFairy(object):
in subsequent instances of :class:`.ConnectionFairy`.
"""
+ # TODO: this never fires
try:
return self._connection_record.info
except AttributeError:
Comments (3)
-
reporter -
reporter - changed status to resolved
d3d10c982c8a44c85a0114c has us ready to let dialects make better use of execution options.
-
reporter - removed milestone
Removing milestone: 0.9.0 (automated comment)
- Log in to comment
work has begun at 60eee33bca6f815932ef11074da0c358668f82c8