From: Gord Thompson Date: Fri, 24 Apr 2020 15:05:47 +0000 (-0600) Subject: Enable loading of external Firebird dialect, if available X-Git-Tag: rel_1_3_17~16^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=901587e1eed71f1bfde3e4a5bb25bcffbbdeb11c;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git Enable loading of external Firebird dialect, if available Fixes: #5278 Change-Id: I1660abb11c02656fbf388f2f9c4257075111be58 (cherry picked from commit 8c5aa7d3e0f853e30249cf1ad9e1f7e7d426a245) --- diff --git a/doc/build/changelog/unreleased_13/5278.rst b/doc/build/changelog/unreleased_13/5278.rst new file mode 100644 index 0000000000..aaf59ae167 --- /dev/null +++ b/doc/build/changelog/unreleased_13/5278.rst @@ -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. diff --git a/lib/sqlalchemy/dialects/__init__.py b/lib/sqlalchemy/dialects/__init__.py index 4407ab62de..741ea06889 100644 --- a/lib/sqlalchemy/dialects/__init__.py +++ b/lib/sqlalchemy/dialects/__init__.py @@ -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