Issue Summary

Scheduled query not working in the latest preview Docker Image (redash/redash:preview).

Steps to Reproduce

redash_scheduled_worker_1 has error:

[2021-03-27 07:27:06,319][PID:520][ERROR][rq.worker] AttributeError: 'NoneType' object has no attribute 'id'
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/rq/worker.py", line 934, in perform_job
    rv = job.perform()
  File "/usr/local/lib/python3.7/site-packages/rq/job.py", line 686, in perform
    self._result = self._execute()
  File "/usr/local/lib/python3.7/site-packages/rq/job.py", line 692, in _execute
    return self.func(*self.args, **self.kwargs)
  File "/app/redash/tasks/queries/execution.py", line 288, in execute_query
    scheduled_query_id is not None,
  File "/app/redash/tasks/queries/execution.py", line 175, in __init__
    models.scheduled_queries_executions.update(self.query_model.id)
AttributeError: 'NoneType' object has no attribute 'id'
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/rq/worker.py", line 934, in perform_job
    rv = job.perform()
  File "/usr/local/lib/python3.7/site-packages/rq/job.py", line 686, in perform
    self._result = self._execute()
  File "/usr/local/lib/python3.7/site-packages/rq/job.py", line 692, in _execute
    return self.func(*self.args, **self.kwargs)
  File "/app/redash/tasks/queries/execution.py", line 288, in execute_query
    scheduled_query_id is not None,
  File "/app/redash/tasks/queries/execution.py", line 175, in __init__
    models.scheduled_queries_executions.update(self.query_model.id)
AttributeError: 'NoneType' object has no attribute 'id'

If I revert this commit (Reset failure counter on adhoc success (#5394) · getredash/redash@9fdf1f3 · GitHub), it works again.

Technical details:

  • Redash Version: Version: 9.0.0-beta (44178d99)
  • Browser/OS: Chrome
  • How did you install Redash: Docker

I don’t have a fix (yet). Just confirming I can reproduce this.

So the problem is on line 175 of execution.py. I fixed it with this change. Will open a pull request against the repo once I know it still passes the tests.

There’s a pull request not: Fixes issue #5445: Scheduled query not working by susodapop · Pull Request #5448 · getredash/redash · GitHub

I’ve cherry picked the pull request on the master;
Some queries are now refreshed, but it seems only the one with no parameters.
(No logs or failures can be found in the logs)

Can someone tells me what should be the behavior for query with parameters ?
same question for dashboards

It shouldn’t work per the docs.

thanks for the clarification;
it confirms that the PR is working

The PR merged after a few significant changes. Make sure to pull the latest master lest you run into job locking issues.

It has been merged;
I’ve fetched the main and deployed it;
Works fine for me :sunglasses:

Will the fix be merged into the release/9.0.0x branch too?

1 Like