Fix the query.

Missing the where clause to join the two tables.... OOPS
This commit is contained in:
Rebecca Law
2019-11-07 10:57:31 +00:00
parent 43c0122dd0
commit 559faf3034
3 changed files with 19 additions and 11 deletions

View File

@@ -195,11 +195,12 @@ def find_jobs_with_missing_rows():
# Using 10 minutes as a condition seems reasonable.
ten_minutes_ago = datetime.utcnow() - timedelta(minutes=10)
jobs_with_rows_missing = db.session.query(
func.count(Notification.id).label('count_notifications'),
func.count(Notification.id).label('actual_count'),
Job
).filter(
Job.job_status == JOB_STATUS_FINISHED,
Job.processing_finished < ten_minutes_ago
Job.processing_finished < ten_minutes_ago,
Job.id == Notification.job_id
).group_by(
Job
).having(