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_4_0b1~356^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8c5aa7d3e0f853e30249cf1ad9e1f7e7d426a245;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git Enable loading of external Firebird dialect, if available Fixes: #5278 Change-Id: I1660abb11c02656fbf388f2f9c4257075111be58 --- 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 9b46a4d0c9..85929a9d67 100644 --- a/lib/sqlalchemy/dialects/__init__.py +++ b/lib/sqlalchemy/dialects/__init__.py @@ -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