Bug description
Setting up a development environment following https://superset.apache.org/docs/contributing/development#docker-compose-recommended does not work.
What's already in place?
OS
No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 22.04.5 LTS Release: 22.04 Codename: jammy
Docker
Client: Docker Engine - Community Version: 27.4.1 API version: 1.47 Go version: go1.22.10 Git commit: b9d17ea Built: Tue Dec 17 15:45:42 2024 OS/Arch: linux/amd64 Context: default
Server: Docker Engine - Community Engine: Version: 27.4.1 API version: 1.47 (minimum version 1.24) Go version: go1.22.10 Git commit: c710b88 Built: Tue Dec 17 15:45:42 2024 OS/Arch: linux/amd64 Experimental: false containerd: Version: 1.7.24 GitCommit: 88bf19b2105c8b17560993bee28a01ddc2f97182 runc: Version: 1.2.2 GitCommit: v1.2.2-0-g7cb3632 docker-init: Version: 0.19.0 GitCommit: de40ad0
Superset commit
531f1b6aa (HEAD) chore(gha): bump ubuntu to latest fresh release (#31390)
723ef591a fix: add various recent issues on master CI (#31561)
Steps to reproduce the error
sudo docker compose up --build
Observed error
superset_worker | File "/app/.venv/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1910, in _execute_context
superset_worker | self.dialect.do_execute(
superset_worker | File "/app/.venv/lib/python3.10/site-packages/sqlalchemy/engine/default.py", line 736, in do_execute
superset_worker | cursor.execute(statement, parameters)
superset_worker | sqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedTable) relation "report_schedule" does not exist
superset_worker | LINE 2: FROM report_schedule
superset_worker | ^
superset_worker |
superset_worker | [SQL: SELECT report_schedule.created_on AS report_schedule_created_on, report_schedule.changed_on AS report_schedule_changed_on, report_schedule.extra_json AS report_schedule_extra_json, report_schedule.id AS report_schedule_id, report_schedule.type AS report_schedule_type, report_schedule.name AS report_schedule_name, report_schedule.description AS report_schedule_description, report_schedule.context_markdown AS report_schedule_context_markdown, report_schedule.active AS report_schedule_active, report_schedule.crontab AS report_schedule_crontab, report_schedule.creation_method AS report_schedule_creation_method, report_schedule.timezone AS report_schedule_timezone, report_schedule.report_format AS report_schedule_report_format, report_schedule.sql AS report_schedule_sql, report_schedule.chart_id AS report_schedule_chart_id, report_schedule.dashboard_id AS report_schedule_dashboard_id, report_schedule.database_id AS report_schedule_database_id, report_schedule.last_eval_dttm AS report_schedule_last_eval_dttm, report_schedule.last_state AS report_schedule_last_state, report_schedule.last_value AS report_schedule_last_value, report_schedule.last_value_row_json AS report_schedule_last_value_row_json, report_schedule.validator_type AS report_schedule_validator_type, report_schedule.validator_config_json AS report_schedule_validator_config_json, report_schedule.log_retention AS report_schedule_log_retention, report_schedule.grace_period AS report_schedule_grace_period, report_schedule.working_timeout AS report_schedule_working_timeout, report_schedule.force_screenshot AS report_schedule_force_screenshot, report_schedule.custom_width AS report_schedule_custom_width, report_schedule.custom_height AS report_schedule_custom_height, report_schedule.email_subject AS report_schedule_email_subject, report_schedule.created_by_fk AS report_schedule_created_by_fk, report_schedule.changed_by_fk AS report_schedule_changed_by_fk
superset_worker | FROM report_schedule
superset_worker | WHERE report_schedule.active IS true]
superset_worker | (Background on this error at: https://sqlalche.me/e/14/f405)
superset_app | 2024-12-20 17:26:21,834:DEBUG:superset.stats_logger:[stats_logger] (incr) health
What appears to solve the problem?
https://github.com/apache/superset/issues/21160#issuecomment-2531927669
i.e. Instead of
sudo docker compose up --build
, do
sudo docker compose run --rm superset superset db upgrade
sudo docker compose up --build
Questions
- Can you reproduce the error?
- If so, why does it occur? Why does the found solution fix it?
- Does the codebase need to be updated somewhere, or does the documentation need to be updated?
Screenshots/recordings
Logging in with username = admin and password = admin:
Superset version
master / latest-dev
Python version
3.10
Node version
16
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 @dkjackyu! I'm here to help you out with any bugs, questions, or contributions you have in mind. Let's squash those bugs and get things sorted! 🤖
I found a similar closed issue that addresses the relation "report_schedule" does not exist
error. The suggested solution is to run the database migrations before starting the application. This involves executing the command sudo docker compose run --rm superset superset db upgrade
before sudo docker compose up --build
. This step ensures that the database schema is up-to-date, which resolves the missing table issue [1].
The error occurs because the database schema is not aligned with the application's expected schema, which includes the report_schedule
table. Running superset db upgrade
applies the necessary database migrations, including the creation of the report_schedule
table and related tables, thus fixing the issue [2].
Regarding updates to the codebase or documentation, the current documentation already emphasizes the importance of running superset db upgrade
before starting the application. It seems that the documentation is correct, but ensuring that users follow these steps is crucial for a smooth setup experience.
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: belcherj
Look back through the terminal output to see if you have certificate errors.
Can This could be caused by being behind a VPN.
Comment From: mistercrunch
Guessing this is a database migration issue after switching branches, the easiest way to sort this out is nuking the Postgres database -> https://superset.apache.org/docs/contributing/development/#nuking-the-postgres-database
Comment From: mistercrunch
Not sure how to make it easier to discover/workaround this issue. This will happen anytime you're "ahead of database migration", where alembic
keeps a list of database version, and gets lost if you switch from a branch with a new migration that doesn't exist in the branch you're in at that moment.
Note that it's possible to superset db downgrade
to the latest shared database migration between the two branches, but that's pretty involved and generally nuking the Postgres is the right fix. That's relevant in cases where you want to maintain the database state for a reason or another.
Comment From: rusackas
Anyone still facing this and considering it a bug? It's been quiet for a while, so I'm hopeful the above comments about nuking the DB may have resolved the issue.