Merge pull request #365 from usingsky/fix-SAWarning

Fix SAWarning when tracking update from ckan
This commit is contained in:
Stefan Oderbolz 2019-07-09 07:58:49 +02:00 committed by GitHub
commit b8cf47bb91
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -1,4 +1,4 @@
from sqlalchemy import distinct, func
from sqlalchemy import distinct, func, text
from ckan.model import Package, Group
from ckan import logic
@ -66,7 +66,7 @@ def harvest_job_dictize(job, context):
.join(HarvestObject) \
.filter(HarvestObject.harvest_job_id == job.id) \
.group_by(HarvestObjectError.message) \
.order_by('error_count desc') \
.order_by(text('error_count desc')) \
.limit(context.get('error_summmary_limit', 20))
out['object_error_summary'] = q.all()
q = model.Session.query(
@ -74,7 +74,7 @@ def harvest_job_dictize(job, context):
func.count(HarvestGatherError.message).label('error_count')) \
.filter(HarvestGatherError.harvest_job_id == job.id) \
.group_by(HarvestGatherError.message) \
.order_by('error_count desc') \
.order_by(text('error_count desc')) \
.limit(context.get('error_summmary_limit', 20))
out['gather_error_summary'] = q.all()
return out