From 14d4bb7163ae9e9e8468edd7243254ef77e3e4b3 Mon Sep 17 00:00:00 2001 From: Konstantin Sivakov Date: Mon, 15 Mar 2021 10:16:44 +0100 Subject: [PATCH] Wrap the sql expresion to sqlalchemy text --- ckanext/googleanalytics/dbutil.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ckanext/googleanalytics/dbutil.py b/ckanext/googleanalytics/dbutil.py index 7f10d37..1314e8c 100644 --- a/ckanext/googleanalytics/dbutil.py +++ b/ckanext/googleanalytics/dbutil.py @@ -104,7 +104,7 @@ def get_top_packages(limit=20): ).order_by(package_stats.c.visits_recently.desc()) res = connection.execute(s).fetchmany(limit) for package_id, recent, ever in res: - item = q.filter("package.id = '%s'" % package_id) + item = q.filter(text("package.id = '%s'" % package_id)) if not item.count(): continue items.append((item.first(), recent, ever))