Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scheduled Report Error: An unexpected occurred while executing the report (still) #31625

Open
3 tasks done
zabullet opened this issue Dec 26, 2024 · 2 comments
Open
3 tasks done
Labels
alert-reports Namespace | Anything related to the Alert & Reports feature

Comments

@zabullet
Copy link

Bug description

My celery worker is throwing the following error for scheduled reports

There are similar reports

#13698
#26335

However I haven't seen this resolved as such and as this is a default install I believe it to be a valid bug.

Exception log

sqlalchemy.exc.StatementError: (builtins.TypeError) SQLite DateTime type only accepts Python datetime and date objects as input.
[SQL: INSERT INTO report_execution_log (uuid, scheduled_dttm, start_dttm, end_dttm, value, value_row_json, state, error_message, report_schedule_id) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)]
[parameters: [{'scheduled_dttm': '2024-12-26T16:24:00', 'state': <ReportState.WORKING: 'Working'>, 'report_schedule_id': 1, 'end_dttm': datetime.datetime(2024, 12, ... (57 characters truncated) ... -bfb1-6927ea86f73e'), 'start_dttm': datetime.datetime(2024, 12, 26, 16, 24, 0, 110666), 'value_row_json': None, 'error_message': None, 'value': None}]]

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/opt/superset/venv.superset/lib/python3.10/site-packages/superset/commands/report/execute.py", line 799, in run
).run()
File "/opt/superset/venv.superset/lib/python3.10/site-packages/superset/utils/decorators.py", line 266, in wrapped
return on_error(ex)
File "/opt/superset/venv.superset/lib/python3.10/site-packages/superset/utils/decorators.py", line 234, in on_error
raise reraise() from ex
sqlalchemy.exc.SQLAlchemyError: ()

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/opt/superset/venv.superset/lib/python3.10/site-packages/superset/tasks/scheduler.py", line 95, in execute
).run()
File "/opt/superset/venv.superset/lib/python3.10/site-packages/superset/utils/decorators.py", line 266, in wrapped
return on_error(ex)
File "/opt/superset/venv.superset/lib/python3.10/site-packages/superset/utils/decorators.py", line 236, in on_error
raise ex
File "/opt/superset/venv.superset/lib/python3.10/site-packages/superset/utils/decorators.py", line 259, in wrapped
result = func(*args, **kwargs)
File "/opt/superset/venv.superset/lib/python3.10/site-packages/superset/commands/report/execute.py", line 803, in run
raise ReportScheduleUnexpectedError(str(ex)) from ex
superset.commands.report.exceptions.ReportScheduleUnexpectedError: ()

Screenshots/recordings

No response

Superset version

4.1.1

Python version

3.10

Node version

I don't know

Browser

Chrome

Additional context

No response

Checklist

  • I have searched Superset docs and Slack and didn't find a solution to my problem.
  • I have searched the GitHub issue tracker and didn't find a similar bug report.
  • I have checked Superset's logs for errors and if I found a relevant Python stacktrace, I included it here as text in the "additional context" section.
Copy link

dosubot bot commented Dec 26, 2024

Hey @zabullet! I'm here to help you with any bugs, questions, or contributions. Let's tackle this issue together!

There are two similar closed issues related to the error you're encountering with scheduled reports in Apache Superset:

  1. Issue Scheduled Report Error: An unexpected occurred while executing the report #13698: This issue discusses a similar problem with scheduled reports failing due to a TypeError when inserting records into the report_execution_log table. The suggested solution was to switch from SQLite to PostgreSQL for metadata, as SQLite doesn't support date-time properly, which causes scheduling problems. Alternatively, there is a fix available for those who want to stay on SQLite [1].

  2. Issue Not able to Schedule Report , some issue in the latest release #26335: This issue also highlights a problem with datetime handling in SQLite when using Superset version 4.1.1 and Python 3.10. The error is caused by an attempt to insert a datetime string into a SQLite database, which only accepts Python datetime and date objects. The issue was closed, and the recommended solution was to switch to a more robust database like PostgreSQL [2].

Switching your metadata database from SQLite to PostgreSQL might resolve the issue you're facing.

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other

@dosubot dosubot bot added the alert-reports Namespace | Anything related to the Alert & Reports feature label Dec 26, 2024
@zabullet
Copy link
Author

zabullet commented Dec 26, 2024

Dosubot is sort of right. Moving to PostgresSQL does appear to be a prerequisite but is only mentioned in Docker specific section of https://superset.apache.org/docs/configuration/alerts-reports and not in the Common section. IMO this is a bug as the default superset supports email reports and default database is SQLite. It should work out of the box.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
alert-reports Namespace | Anything related to the Alert & Reports feature
Projects
None yet
Development

No branches or pull requests

1 participant