.. changelog::
:version: 1.0.5
+ .. change::
+ :tags: feature, engine
+ :tickets: 3379
+
+ 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.
+
+
.. change::
:tags: bug, ext
:tickets: 3427
# 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):
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:
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.