Skip to content

Commit

Permalink
[QOLDEV-955] fix SQLAlchemy syntax for latest CKAN master
Browse files Browse the repository at this point in the history
- Drop unwanted square brackets around select list
  • Loading branch information
ThrawnCA committed Jan 30, 2025
1 parent cabe2d4 commit f12a663
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions ckanext/qgov/common/stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def top_categories(cls, limit=10):
"""
member = table('member')
package = table('package')
query = select([member.c.group_id, func.count(member.c.table_id)]). \
query = select(member.c.group_id, func.count(member.c.table_id)). \
group_by(member.c.group_id). \
where(and_(member.c.group_id is not None,
member.c.table_name == 'package',
Expand All @@ -43,7 +43,7 @@ def top_organisations(cls, limit=10):
""" Displays the most-used organisations (by default, top 10).
"""
package = table('package')
query = select([package.c.owner_org, func.count(package.c.owner_org)]). \
query = select(package.c.owner_org, func.count(package.c.owner_org)). \
group_by(package.c.owner_org). \
where(and_(package.c.state == 'active', package.c.private == 'FALSE')). \
order_by(func.count(package.c.owner_org).desc()). \
Expand All @@ -59,7 +59,7 @@ def resource_count(cls):
"""
resource = table('resource')
package = table('package')
query = select([func.count(resource.c.id)]). \
query = select(func.count(resource.c.id)). \
where(and_(resource.c.package_id == package.c.id,
resource.c.state == 'active',
package.c.state == 'active',
Expand All @@ -77,7 +77,7 @@ def resource_report(cls):
resource = table('resource')
group = table('group')
package = table('package')
query = select([group.c.title, package.c.title, resource.c.name, resource.c.url, resource.c.created, resource.c.last_modified, resource.c.format, resource.c.webstore_url if hasattr(resource.c, 'webstore_url') else None, resource.c.resource_type]). \
query = select(group.c.title, package.c.title, resource.c.name, resource.c.url, resource.c.created, resource.c.last_modified, resource.c.format, resource.c.webstore_url if hasattr(resource.c, 'webstore_url') else None, resource.c.resource_type). \
where(and_(resource.c.package_id == package.c.id,
resource.c.state == 'active',
group.c.id == package.c.owner_org))
Expand All @@ -91,7 +91,7 @@ def resource_org_count(cls, org_id):
"""
resource = table('resource')
package = table('package')
query = select([func.count(resource.c.id)]). \
query = select(func.count(resource.c.id)). \
where(and_(resource.c.state == 'active',
package.c.state == 'active',
resource.c.package_id == package.c.id,
Expand Down

0 comments on commit f12a663

Please sign in to comment.