From: Mike Bayer Date: Fri, 5 Nov 2021 16:19:12 +0000 (-0400) Subject: use a heuristic for pure "future engine" until future engine merges X-Git-Tag: rel_1_7_5~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3ab86677f4ce40ff96c1320f82657e7a0e73bcb9;p=thirdparty%2Fsqlalchemy%2Falembic.git use a heuristic for pure "future engine" until future engine merges Change-Id: I0d5605091c3010ce50bcd0083dfb3c9615212d22 --- diff --git a/alembic/util/sqla_compat.py b/alembic/util/sqla_compat.py index a05e27bc..57a6a769 100644 --- a/alembic/util/sqla_compat.py +++ b/alembic/util/sqla_compat.py @@ -58,7 +58,15 @@ _vers = tuple( sqla_13 = _vers >= (1, 3) sqla_14 = _vers >= (1, 4) sqla_14_26 = _vers >= (1, 4, 26) -sqla_1x = _vers < (2,) + + +if sqla_14: + # when future engine merges, this can be again based on version string + from sqlalchemy.engine import Connection as legacy_connection + + sqla_1x = not hasattr(legacy_connection, "commit") +else: + sqla_1x = True try: from sqlalchemy import Computed # noqa