Merge pull request #60 from tino097/59-textual-sql-declared-as-text

Wrap the sql expresion to sqlalchemy text
This commit is contained in:
Sergey 2021-03-16 08:44:28 +07:00 committed by GitHub
commit 7859e01b12
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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()) ).order_by(package_stats.c.visits_recently.desc())
res = connection.execute(s).fetchmany(limit) res = connection.execute(s).fetchmany(limit)
for package_id, recent, ever in res: 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(): if not item.count():
continue continue
items.append((item.first(), recent, ever)) items.append((item.first(), recent, ever))