]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
- The entry point resolution supported by
authorMike Bayer <mike_mp@zzzcomputing.com>
Sat, 24 Sep 2011 13:01:31 +0000 (09:01 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Sat, 24 Sep 2011 13:01:31 +0000 (09:01 -0400)
    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]

CHANGES
lib/sqlalchemy/engine/url.py

diff --git a/CHANGES b/CHANGES
index 56d9140d7e1a8dc32dca2bfcc376fe8ab49ca41a..c1c4b83b89225ad753c77b076c44fceb64290345 100644 (file)
--- 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;
index 0734f6035fdda4bd7aed277056b25e5bd9211665..f896eee296ca6c4facf9caf2c9752568ecb5ffd7 100644 (file)
@@ -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