guix/gnu/packages/patches/gourmet-sqlalchemy-compat.patch
Maxim Cournoyer cfc02804fc
gnu: gourmet: Update to 0.17.4-0-8af29c8 and enable tests.
* gnu/packages/patches/gourmet-sqlalchemy-compat.patch: Add file.
* gnu/local.mk (dist_patch_DATA): Register it.
* gnu/packages/nutrition.scm (gourmet): Update to 0.17.4-0-8af29c8.
[source]: Apply patch.
[python]: Delete argument.
[tests?]: Likewise.
[phases]{prepare-x}: New phase.
{check}: New phase override.
{install-dekstop-file-and-icons}: New phase.
[native-inputs]: Delete python2-distutils-extra, intltool and python2-pygtk.
Add python-dogtail, python-pytest, python-selenium and xorg-server-for-tests.
[inputs]: Delete python2-pygtk, python2-sqlalchemy, python2-lxml,
python2-pillow and python2-elib.intl.
Add gtk+, python-argcomplete, python-beautifulsoup4, python-gst,
python-keyring, python-lxml, python-pillow, python-pycairo, python-pyenchant,
python-pygobject, python-requests, python-scrape-schema-recipe,
python-sqlalchemy.
2022-05-31 14:52:34 -04:00

19 lines
819 B
Diff

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