Bug description
My celery worker is throwing the following error for scheduled reports
There are similar reports
https://github.com/apache/superset/issues/13698 https://github.com/apache/superset/issues/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':
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
- [X] I have searched Superset docs and Slack and didn't find a solution to my problem.
- [X] I have searched the GitHub issue tracker and didn't find a similar bug report.
- [X] 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.
Comment From: dosubot[bot]
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:
-
Issue #13698: This issue discusses a similar problem with scheduled reports failing due to a
TypeError
when inserting records into thereport_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]. -
Issue #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
Comment From: zabullet
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.
Comment From: rusackas
If you're up for it, a PR to improve documentation is always welcome. Otherwise, it could also be stated that one should not be using SQLite in production. Aside from potential documentation improvements (which we're fans of!) is it fair to say we can/should close this as solved?
Comment From: rusackas
This hit my "inactive issues" radar, but I wanted to check in one more time. Do you (or anyone reading this) have interest in addressing whatever the SQLite issue is, and/or updating the docs? The docs do say that SQlite should not be used as a metadata database in production. If just moving it from on section to the other in the Docker area is easy enough if you think that works.
Comment From: rusackas
Closing as inactive / not-planned, as it seems to have gone silent here.