From: Mike Bayer Date: Sat, 24 Sep 2011 13:01:31 +0000 (-0400) Subject: - The entry point resolution supported by X-Git-Tag: rel_0_7_3~29 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e80b725a953d153b132bce62564cbf6b773a8769;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git - The entry point resolution supported by create_engine() now supports resolution of individual DBAPI drivers on top of a built-in or entry point-resolved dialect, using the standard '+' notation - it's converted to a '.' before being resolved as an entry point. [ticket:2286] --- diff --git a/CHANGES b/CHANGES index 56d9140d7e..c1c4b83b89 100644 --- a/CHANGES +++ b/CHANGES @@ -163,6 +163,14 @@ CHANGES pool.manage(dbapi).connect() so that serialization of args is not necessary. + - The entry point resolution supported by + create_engine() now supports resolution of + individual DBAPI drivers on top of a built-in + or entry point-resolved dialect, using the + standard '+' notation - it's converted to + a '.' before being resolved as an entry + point. [ticket:2286] + - types - Extra keyword arguments to the base Float type beyond "precision" and "asdecimal" are ignored; diff --git a/lib/sqlalchemy/engine/url.py b/lib/sqlalchemy/engine/url.py index 0734f6035f..f896eee296 100644 --- a/lib/sqlalchemy/engine/url.py +++ b/lib/sqlalchemy/engine/url.py @@ -104,7 +104,14 @@ class URL(object): module = __import__('sqlalchemy.dialects.%s' % (dialect, )).dialects module = getattr(module, dialect) - module = getattr(module, driver) + if hasattr(module, driver): + module = getattr(module, driver) + else: + module = self._load_entry_point() + if module is None: + raise exc.ArgumentError( + "Could not determine dialect for '%s'." % + self.drivername) return module.dialect except ImportError: @@ -128,7 +135,7 @@ class URL(object): return None for res in pkg_resources.iter_entry_points('sqlalchemy.dialects'): - if res.name == self.drivername: + if res.name == self.drivername.replace("+", "."): return res.load() else: return None