diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2015-05-22 13:51:00 -0400 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2015-05-22 13:51:00 -0400 |
| commit | 04c625467e65ec4189d4fd73e0e10c727f04dce6 (patch) | |
| tree | 454220f26352b5454f18d0627999d35fed5d86b0 /lib/sqlalchemy | |
| parent | c581b907b3f1bcee3ab347e9a93c2c2b37bfe7ef (diff) | |
| download | sqlalchemy-04c625467e65ec4189d4fd73e0e10c727f04dce6.tar.gz | |
- Adjustments to the engine plugin hook, such that the
:meth:`.URL.get_dialect` method will continue to return the
ultimate :class:`.Dialect` object when a dialect plugin is used,
without the need for the caller to be aware of the
:meth:`.Dialect.get_dialect_cls` method.
reference #3379
Diffstat (limited to 'lib/sqlalchemy')
| -rw-r--r-- | lib/sqlalchemy/engine/strategies.py | 3 | ||||
| -rw-r--r-- | lib/sqlalchemy/engine/url.py | 18 |
2 files changed, 12 insertions, 9 deletions
diff --git a/lib/sqlalchemy/engine/strategies.py b/lib/sqlalchemy/engine/strategies.py index a802e5d90..e2a086de4 100644 --- a/lib/sqlalchemy/engine/strategies.py +++ b/lib/sqlalchemy/engine/strategies.py @@ -48,8 +48,7 @@ class DefaultEngineStrategy(EngineStrategy): # create url.URL object u = url.make_url(name_or_url) - entrypoint = u.get_dialect() - dialect_cls = entrypoint.get_dialect_cls(u) + entrypoint, dialect_cls = u._get_dialect_plus_entrypoint() if kwargs.pop('_coerce_config', False): def pop_kwarg(key, default=None): diff --git a/lib/sqlalchemy/engine/url.py b/lib/sqlalchemy/engine/url.py index d045961dd..07f6a5730 100644 --- a/lib/sqlalchemy/engine/url.py +++ b/lib/sqlalchemy/engine/url.py @@ -117,11 +117,7 @@ class URL(object): else: return self.drivername.split('+')[1] - def get_dialect(self): - """Return the SQLAlchemy database dialect class corresponding - to this URL's driver name. - """ - + def _get_dialect_plus_entrypoint(self): if '+' not in self.drivername: name = self.drivername else: @@ -133,9 +129,17 @@ class URL(object): if hasattr(cls, 'dialect') and \ isinstance(cls.dialect, type) and \ issubclass(cls.dialect, Dialect): - return cls.dialect + return cls.dialect, cls.dialect else: - return cls + dialect_cls = cls.get_dialect_cls(self) + return cls, dialect_cls + + def get_dialect(self): + """Return the SQLAlchemy database dialect class corresponding + to this URL's driver name. + """ + entrypoint, dialect_cls = self._get_dialect_plus_entrypoint() + return dialect_cls def translate_connect_args(self, names=[], **kw): """Translate url attributes into a dictionary of connection arguments. |
