projects/guix·blob javascript-team · refs

18 lines · 819 B

1diff --git a/gourmet/backends/db.py b/gourmet/backends/db.py
2index faa6a57a..7e6d2bc6 100644
3--- a/gourmet/backends/db.py
4+++ b/gourmet/backends/db.py
5@@ -773,9 +773,11 @@ class RecData (Pluggable):
6 """Return the number of rows in table that match criteria
7 """
8 if criteria:
9- return table.count(*make_simple_select_arg(criteria,table)).execute().fetchone()[0]
10+ return sqlalchemy.select(
11+ sqlalchemy.func.count(criteria)).select_from(table).scalar()
12 else:
13- return table.count().execute().fetchone()[0]
14+ return sqlalchemy.select(
15+ sqlalchemy.func.count()).select_from(table).scalar()
16
17 def fetch_join (self, table1, table2, col1, col2,
18 column_names=None, sort_by=[], **criteria):