From 9c40a26264995f7dd53a8c5cb5f40b7a8869afe1 Mon Sep 17 00:00:00 2001 From: Sergey Motornyuk Date: Sat, 7 Sep 2024 23:44:10 +0300 Subject: [PATCH] chore: update deprecated SA code --- ckanext/collection/utils/data/model.py | 2 +- pyproject.toml | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/ckanext/collection/utils/data/model.py b/ckanext/collection/utils/data/model.py index 9db9c53..4be5c50 100644 --- a/ckanext/collection/utils/data/model.py +++ b/ckanext/collection/utils/data/model.py @@ -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): diff --git a/pyproject.toml b/pyproject.toml index 5d26585..50ad43e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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", ]