Enable loading of external Firebird dialect, if available

Fixes: #5278
Change-Id: I1660abb11c02656fbf388f2f9c4257075111be58
(cherry picked from commit 8c5aa7d3e0)
This commit is contained in:
Gord Thompson
2020-04-24 09:05:47 -06:00
parent b72c14cde2
commit 901587e1ee
2 changed files with 15 additions and 1 deletions
+7
View File
@@ -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.
+8 -1
View 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