From 533bd247a0fd6a08c527bc27d1a303487c6ad144 Mon Sep 17 00:00:00 2001 From: dmo Date: Thu, 9 Dec 2021 10:39:46 +0100 Subject: [PATCH] fix compatibility with sqlalchemy 1.4 --- src/gourmand/backends/db.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gourmand/backends/db.py b/src/gourmand/backends/db.py index 7f538c97..f729cbd9 100644 --- a/src/gourmand/backends/db.py +++ b/src/gourmand/backends/db.py @@ -9,7 +9,7 @@ import sqlalchemy.orm from gi.repository import Gtk from sqlalchemy import (Boolean, Column, Float, ForeignKey, Integer, - LargeBinary, Numeric, String, Table, Text, event, func) + LargeBinary, Numeric, String, Table, Text, event, func, select) from sqlalchemy.sql import and_, case, or_ import gourmand.__version__ @@ -741,9 +741,9 @@ def fetch_len (self, table, **criteria): """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 select(*make_simple_select_arg(criteria,table)) else: - return table.count().execute().fetchone()[0] + return select([func.count()]).select_from(table) def fetch_join (self, table1, table2, col1, col2, column_names=None, sort_by=None, **criteria):