summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/engine/url.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2015-05-22 13:51:00 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2015-05-22 13:51:00 -0400
commit04c625467e65ec4189d4fd73e0e10c727f04dce6 (patch)
tree454220f26352b5454f18d0627999d35fed5d86b0 /lib/sqlalchemy/engine/url.py
parentc581b907b3f1bcee3ab347e9a93c2c2b37bfe7ef (diff)
downloadsqlalchemy-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/engine/url.py')
-rw-r--r--lib/sqlalchemy/engine/url.py18
1 files changed, 11 insertions, 7 deletions
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.