diff --git a/alembic/runtime/migration.py b/alembic/runtime/migration.py index 70860324..1676b275 100644 --- a/alembic/runtime/migration.py +++ b/alembic/runtime/migration.py @@ -23,7 +23,6 @@ from typing import Union from sqlalchemy import Column -from sqlalchemy import select from sqlalchemy import literal_column from sqlalchemy.engine import Engine from sqlalchemy.engine import url as sqla_url @@ -33,6 +32,7 @@ from .. import util from ..util import sqla_compat from ..util.compat import EncodedIO +from ..util.sqla_compat import _select if TYPE_CHECKING: from sqlalchemy.engine import Dialect @@ -530,16 +530,10 @@ def get_current_heads(self) -> Tuple[str, ...]: if not self._has_version_table(): return () assert self.connection is not None - if util.sqla_14: - return tuple( - row[0] for row in self.connection.execute( - select(self._version.c.version_num)) - ) - else: - return tuple( - row[0] for row in self.connection.execute( - select([self._version.c.version_num])) # type: ignore - ) + return tuple( + row[0] for row in self.connection.execute( + _select(self._version.c.version_num)) + ) def _ensure_version_table(self, purge: bool = False) -> None: with sqla_compat._ensure_scope_for_ddl(self.connection): diff --git a/tests/test_version_table.py b/tests/test_version_table.py index 9d805140..48cd4e56 100644 --- a/tests/test_version_table.py +++ b/tests/test_version_table.py @@ -5,7 +5,6 @@ from sqlalchemy import PrimaryKeyConstraint from sqlalchemy import String from sqlalchemy import Table -from sqlalchemy.dialects import registry from alembic import migration from alembic.ddl import impl