ckan / ckanext-googleanalytics

CKAN extension to integrate Google Analytics data into CKAN. Gives download stats on package pages, list of most popular packages, etc.
GNU Affero General Public License v3.0
35 stars 81 forks source link

Textual SQL expression should be explicitly declared as text #59

Closed tino097 closed 3 years ago

tino097 commented 3 years ago

When calling get_top_packages on return result set filtering im getting this error

sqlalchemy.exc.ArgumentError: Textual SQL expression "package.id = 'b4e66cda-2e..." should be explicitly declared as text("package.id = 'b4e66cda-2e...")

Possible solution is to wrap the expression with the sqlalchemy text

q.filter(text("package.id = '%s'" % package_id))