-
Notifications
You must be signed in to change notification settings - Fork 14.3k
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
Can download image from chart, not from dashboard (Attempted use of SQLite instead of Postgres) #31906
Comments
I found a similar unsolved discussion titled "Superset insert data to sqlite3 rather than postgresql" which might be related to your issue. You can view it here [1]. Additionally, there are two closed issues with no solutions found in the comments, which might not be directly helpful but indicate similar SQLite-related problems [2][3]. Regarding your issue, it seems that Superset might be defaulting to SQLite instead of the configured Postgres database. This can happen if the SQLALCHEMY_DATABASE_URI = 'postgresql://<UserName>:<DBPassword>@<Database Host>/<Database Name>' If the configuration file is not properly loaded or if the connection string is incorrect or missing, Superset may fall back to its default SQLite configuration. Additionally, if your home directory is NFS mounted, Superset may default to SQLite due to known issues with SQLite on NFS [4][5]. SQLite has limitations, especially in handling datetime objects, which can lead to errors when executing scheduled reports. This makes SQLite unsuitable for generating images or PDFs in the context of scheduled reports, and PostgreSQL is recommended for such features [6][5]. To continue talking to Dosu, mention @dosu. Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other |
This is not the issue, as the postgres database is correctly configured for everything else. The entire superset build works, I have users, I can create datasources, charts, dashboards, everything gets stored properly in Postgres. However, when trying to download as an image -specifically a Dashboard cause a Chart does work fine- somehow it tries to call on Sqlite. |
The issue you're experiencing with the 'Save as Image' or 'Save as PDF' functionality for dashboards might be related to a specific part of the Superset codebase that handles these operations. The frontend component responsible for this is the Given that your configuration for Postgres is correct for other operations, it's possible that there might be a misconfiguration or a fallback mechanism specifically affecting the dashboard export feature. Unfortunately, I couldn't find specific documentation or comments in the codebase that mention known issues or special handling for database connections during image or PDF generation. It might be worth checking if there are any environment variables or specific configurations that could be affecting this feature. Additionally, there is a known issue related to database selection during dashboard export operations, described as "Volatile datasource ordering in dashboard export" [3]. This might be related to your problem, so reviewing any recent changes or patches in the Superset codebase related to this functionality could provide further insights. To continue talking to Dosu, mention @dosu. Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other |
@dosu Why would 'Save as Image' work for Charts but not for Dashboards? Are the charts relying on a different backend class to make screenshots? |
The 'Save as Image' functionality works for Charts but not for Dashboards because they rely on different backend classes for making screenshots. Specifically, the The To continue talking to Dosu, mention @dosu. Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other |
Not sure if @sadpandajoe has situational awareness on this one, or can relay it to someone who might be able to reproduce/investigate. (Picking on him since he was on the thread you linked to). |
Bug description
When using the Download -> Save as image button while viewing a chart, everything works fine and the image is created without trouble. However, when using the Download -> Save as Image or Save as PDF button in a dashboard view, the command fails, and on the backend there is a logged attempt at accessing a SQLite file ((sqlite3.OperationalError) unable to open database file). The configured storage for superset metadata is a Postgres DB however.
It is unclear to me why the Save As Image functionality on a chart level tries to refer to a different database than the same functionality at a Dashboard level, and why the latter would attempt to rely on SQLite even though the configured database in the config file is a Postgres DB.
When scouring this GitHub, the only reference I could find is here, on a discussion of the error occuring in 4.1.0rc3 but not in4.1.0rc4. I can not find a specific topic for the issue however, and I'm not sure why it is affecting my 4.0 build.
Screenshots/recordings
No response
Superset version
4.0.2
Python version
3.9
Node version
18 or greater
Browser
Chrome
Additional context
Jan 17, 2025, 3:26:40 PM
None
2025-01-17 14:26:40,024:ERROR:flask_appbuilder.api:(sqlite3.OperationalError) unable to open database file
Jan 17, 2025, 3:26:40 PM
None
2025-01-17 14:26:40,022:INFO:superset.dashboards.api:Triggering screenshot ASYNC
Checklist
The text was updated successfully, but these errors were encountered: