]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Enable loading of external Firebird dialect, if available
authorGord Thompson <gord@gordthompson.com>
Fri, 24 Apr 2020 15:05:47 +0000 (09:05 -0600)
committerGord Thompson <gord@gordthompson.com>
Thu, 30 Apr 2020 17:29:42 +0000 (11:29 -0600)
Fixes: #5278
Change-Id: I1660abb11c02656fbf388f2f9c4257075111be58

doc/build/changelog/unreleased_13/5278.rst [new file with mode: 0644]
lib/sqlalchemy/dialects/__init__.py

diff --git a/doc/build/changelog/unreleased_13/5278.rst b/doc/build/changelog/unreleased_13/5278.rst
new file mode 100644 (file)
index 0000000..aaf59ae
--- /dev/null
@@ -0,0 +1,7 @@
+.. change::
+    :tags: change, firebird
+    :tickets: 5278
+
+    Adjusted dialect loading for ``firebird://`` URIs so the external
+    sqlalchemy-firebird dialect will be used if it has been installed,
+    otherwise fall back to the (now deprecated) internal Firebird dialect.
index 9b46a4d0c96e73e713cb9b690524b4504cbfcdf4..85929a9d676da82074413dad23f72819c7306a03 100644 (file)
@@ -32,7 +32,14 @@ def _auto_fn(name):
         driver = "base"
 
     try:
-        module = __import__("sqlalchemy.dialects.%s" % (dialect,)).dialects
+        if dialect == "firebird":
+            try:
+                module = __import__("sqlalchemy_firebird")
+                dialect = "dialect"
+            except:
+                module = __import__("sqlalchemy.dialects.firebird").dialects
+        else:
+            module = __import__("sqlalchemy.dialects.%s" % (dialect,)).dialects
     except ImportError:
         return None