diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2016-09-02 15:10:32 -0400 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2016-09-16 16:20:18 -0400 |
| commit | 01a0a2d542909456a28fba8e6f16c0e0346e1278 (patch) | |
| tree | 6539a2ded845c16edc002c8c952e6be57f72b5b0 /lib/sqlalchemy/engine | |
| parent | 65d8deac95b63ea5702a9ce6b5d9a6c9a6a60991 (diff) | |
| download | sqlalchemy-01a0a2d542909456a28fba8e6f16c0e0346e1278.tar.gz | |
Additions to support HAAlchemy plugin
- add a connect=True key to connection record to support
pre-loading of _ConnectionRecord objects
- ensure _ConnectionRecord.close() leaves the record in a good
state for reopening
- add _ConnectionRecord.record_info for persistent storage
- add "in_use" accessor based on fairy_ref being present or not
- allow for the exclusions system and SuiteRequirements to be
usable without the full plugin_base setup.
- move some Python-env requirements to the importable
requirements.py module.
- allow starttime to be queried
- add additional events for engine plugins
- have "dialect" be a first-class parameter to the pool,
ensure the engine strategy supplies it up front
Change-Id: Ibf549f7a1766e49d335cd6f5e26bacfaef9a8229
Diffstat (limited to 'lib/sqlalchemy/engine')
| -rw-r--r-- | lib/sqlalchemy/engine/base.py | 1 | ||||
| -rw-r--r-- | lib/sqlalchemy/engine/interfaces.py | 6 | ||||
| -rw-r--r-- | lib/sqlalchemy/engine/strategies.py | 13 |
3 files changed, 18 insertions, 2 deletions
diff --git a/lib/sqlalchemy/engine/base.py b/lib/sqlalchemy/engine/base.py index 83f0f0c83..b8acf298f 100644 --- a/lib/sqlalchemy/engine/base.py +++ b/lib/sqlalchemy/engine/base.py @@ -1752,7 +1752,6 @@ class Engine(Connectable, log.Identified): self.pool = pool self.url = url self.dialect = dialect - self.pool._dialect = dialect if logging_name: self.logging_name = logging_name self.echo = echo diff --git a/lib/sqlalchemy/engine/interfaces.py b/lib/sqlalchemy/engine/interfaces.py index 13e8bf1f4..082661216 100644 --- a/lib/sqlalchemy/engine/interfaces.py +++ b/lib/sqlalchemy/engine/interfaces.py @@ -900,6 +900,12 @@ class CreateEnginePlugin(object): """ self.url = url + def handle_dialect_kwargs(self, dialect_cls, dialect_args): + """parse and modify dialect kwargs""" + + def handle_pool_kwargs(self, pool_cls, pool_args): + """parse and modify pool kwargs""" + def engine_created(self, engine): """Receive the :class:`.Engine` object when it is fully constructed. diff --git a/lib/sqlalchemy/engine/strategies.py b/lib/sqlalchemy/engine/strategies.py index 82800a918..ccda14be4 100644 --- a/lib/sqlalchemy/engine/strategies.py +++ b/lib/sqlalchemy/engine/strategies.py @@ -81,6 +81,9 @@ class DefaultEngineStrategy(EngineStrategy): dialect_args['dbapi'] = dbapi + for plugin in plugins: + plugin.handle_dialect_kwargs(dialect_cls, dialect_args) + # create dialect dialect = dialect_cls(**dialect_args) @@ -106,7 +109,9 @@ class DefaultEngineStrategy(EngineStrategy): poolclass = pop_kwarg('poolclass', None) if poolclass is None: poolclass = dialect_cls.get_pool_class(u) - pool_args = {} + pool_args = { + 'dialect': dialect + } # consume pool arguments from kwargs, translating a few of # the arguments @@ -121,6 +126,10 @@ class DefaultEngineStrategy(EngineStrategy): tk = translate.get(k, k) if tk in kwargs: pool_args[k] = pop_kwarg(tk) + + for plugin in plugins: + plugin.handle_pool_kwargs(poolclass, pool_args) + pool = poolclass(creator, **pool_args) else: if isinstance(pool, poollib._DBProxy): @@ -128,6 +137,8 @@ class DefaultEngineStrategy(EngineStrategy): else: pool = pool + pool._dialect = dialect + # create engine. engineclass = self.engine_cls engine_args = {} |
