dosubot[bot] commented on issue #34332:
URL: https://github.com/apache/superset/issues/34332#issuecomment-3124049017

   <!-- Answer -->
   The error happens because Alembic thinks your metadata database is 
uninitialized—it’s trying to run the very first migration, which creates tables 
like dashboards that already exist. This usually means the alembic_version 
table in your metadata DB is missing, empty, or has the wrong value. Superset 
relies on this table to know which migrations have already run; if it’s out of 
sync, you’ll get “table already exists” errors when upgrading [see migration 
script](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/migrations/versions/2015-09-21_17-30_4e6a06bad7a8_init.py).
   
   To fix:  
   1. Back up your metadata database.
   2. Inspect the alembic_version table (e.g., `SELECT * FROM 
alembic_version;`).  
      - If it’s missing, create it:  
        ```sql
        CREATE TABLE alembic_version (version_num VARCHAR(32) NOT NULL);
        ```
      - If it’s empty or wrong, set it to your last known good revision (for 
you: `48cbb571fa3a`):  
        ```sql
        DELETE FROM alembic_version;
        INSERT INTO alembic_version (version_num) VALUES ('48cbb571fa3a');
        ```
   3. Re-run `superset db upgrade`.
   
   If you’ve had failed or partial migrations before, your schema might be 
inconsistent—consider testing the upgrade on a DB copy first. The official docs 
don’t require any special steps for this upgrade path 
[docs](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/docs/docs/installation/upgrading-superset.mdx).
   
   
   <!-- Dosu Comment Footer -->
   *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).*
   
   ---
   <sup>How did I do? 
[Good](https://app.dosu.dev/response-feedback/bc34f8c3-a5dc-4b0a-bba2-06462a6b5219?feedback_type=great_response)
 | 
[Irrelevant](https://app.dosu.dev/response-feedback/bc34f8c3-a5dc-4b0a-bba2-06462a6b5219?feedback_type=irrelevant_answer)
 | 
[Incorrect](https://app.dosu.dev/response-feedback/bc34f8c3-a5dc-4b0a-bba2-06462a6b5219?feedback_type=incorrect_sources)
 | 
[Verbose](https://app.dosu.dev/response-feedback/bc34f8c3-a5dc-4b0a-bba2-06462a6b5219?feedback_type=too_verbose)
 | 
[Hallucination](https://app.dosu.dev/response-feedback/bc34f8c3-a5dc-4b0a-bba2-06462a6b5219?feedback_type=hallucination)
 | [Report 
🐛](https://app.dosu.dev/response-feedback/bc34f8c3-a5dc-4b0a-bba2-06462a6b5219?feedback_type=bug_report)
 | 
[Other](https://app.dosu.dev/response-feedback/bc34f8c3-a5dc-4b0a-bba2-06462a6b5219?feedback_type=other)</sup>&nbsp;&nbsp;[![Chat
 with 
Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/a28d3c7e-a9d3-459e-9fb6-3a6f9ff4f357/ask?utm_source=githu
 b)&nbsp;[![Join 
Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share
 on 
X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/apache/superset/issues/34332)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to