Skip to content

Commit

Permalink
chore: update deprecated SA code
Browse files Browse the repository at this point in the history
  • Loading branch information
smotornyuk committed Sep 7, 2024
1 parent 1f7843c commit 9c40a26
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 2 deletions.
2 changes: 1 addition & 1 deletion ckanext/collection/utils/data/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def alter_statement(self, stmt: TStatement):

def count_statement(self, stmt: TStatement) -> int:
"""Count number of items in query."""
count_stmt: Select = sa.select(sa.func.count()).select_from(stmt)
count_stmt: Select = sa.select(sa.func.count()).select_from(stmt.subquery())
return cast(int, self._execute(count_stmt).scalar())

def _into_clause(self, column: ColumnElement[Any], value: Any):
Expand Down
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ self = ["ckanext.collection"]
[tool.pytest.ini_options]
addopts = "--ckan-ini test.ini"
filterwarnings = [
"ignore::sqlalchemy.exc.SADeprecationWarning",
"ignore::sqlalchemy.exc.SAWarning",
"ignore::DeprecationWarning",
]
Expand Down

0 comments on commit 9c40a26

Please sign in to comment.