Skip to content

Commit

Permalink
switch to sql_compat _select
Browse files Browse the repository at this point in the history
  • Loading branch information
maver1ck committed Oct 31, 2024
1 parent 82cc69d commit 14539e4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 12 deletions.
16 changes: 5 additions & 11 deletions alembic/runtime/migration.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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):
Expand Down
1 change: 0 additions & 1 deletion tests/test_version_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 14539e4

Please sign in to comment.