]> 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:34:13 +0000 (11:34 -0600)
Fixes: #5278
Change-Id: I1660abb11c02656fbf388f2f9c4257075111be58
(cherry picked from commit 8c5aa7d3e0f853e30249cf1ad9e1f7e7d426a245)

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 4407ab62dee80d2cca65e31598d496e318ff73e0..741ea06889389f2b4a427292d0b5377ef7ef4008 100644 (file)
@@ -42,7 +42,14 @@ def _auto_fn(name):
         )
         dialect = translated
     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