Wrap the sql expresion to sqlalchemy text

This commit is contained in:
Konstantin Sivakov 2021-03-15 10:16:44 +01:00
parent bce5c7a1d2
commit 14d4bb7163
1 changed files with 1 additions and 1 deletions

View File

@ -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))