devikaaaa33 opened a new issue, #34332:
URL: https://github.com/apache/superset/issues/34332

   ### Bug description
   
   Hi Team, I am trying to upgrade superset version from 4.1.1 to 5.0.0 and 
getting below error. Alembic version of old DB is 48cbb571fa3a
   
   Upgrading DB schema...
   Loaded your LOCAL configuration at [/app/pythonpath/superset_config.py]
   2025-07-27 05:45:45,326:INFO:superset.initialization:Setting database 
isolation level to READ COMMITTED
   /app/.venv/lib/python3.11/site-packages/flask_limiter/extension.py:333: 
UserWarning: Using the in-memory storage for tracking rate limits as no storage 
was explicitly specified. This is not recommended for production use. See: 
https://flask-limiter.readthedocs.io#configuring-a-storage-backend for 
documentation about configuring the storage backend.
     warnings.warn(
   2025-07-27 05:45:45,501:INFO:superset.utils.screenshots:No PIL installation 
found
   2025-07-27 05:45:46,207:INFO:superset.utils.pdf:No PIL installation found
   INFO  [alembic.env] Starting the migration scripts.
   INFO  [alembic.runtime.migration] Context impl PostgresqlImpl.
   INFO  [alembic.runtime.migration] Will assume transactional DDL.
   INFO  [alembic.runtime.migration] Running upgrade  -> 4e6a06bad7a8, Init
   Traceback (most recent call last):
     File "/app/.venv/lib/python3.11/site-packages/sqlalchemy/engine/base.py", 
line 1910, in _execute_context
       self.dialect.do_execute(
     File 
"/app/.venv/lib/python3.11/site-packages/sqlalchemy/engine/default.py", line 
736, in do_execute
       cursor.execute(statement, parameters)
   psycopg2.errors.DuplicateTable: relation "dashboards" already exists
   
   
   The above exception was the direct cause of the following exception:
   
   Traceback (most recent call last):
     File "/app/.venv/bin/superset", line 10, in <module>
       sys.exit(superset())
                ^^^^^^^^^^
     File "/app/.venv/lib/python3.11/site-packages/click/core.py", line 1157, 
in __call__
       return self.main(*args, **kwargs)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^
     File "/app/.venv/lib/python3.11/site-packages/click/core.py", line 1078, 
in main
       rv = self.invoke(ctx)
            ^^^^^^^^^^^^^^^^
     File "/app/.venv/lib/python3.11/site-packages/click/core.py", line 1688, 
in invoke
       return _process_result(sub_ctx.command.invoke(sub_ctx))
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File "/app/.venv/lib/python3.11/site-packages/click/core.py", line 1688, 
in invoke
       return _process_result(sub_ctx.command.invoke(sub_ctx))
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File "/app/.venv/lib/python3.11/site-packages/click/core.py", line 1434, 
in invoke
       return ctx.invoke(self.callback, **ctx.params)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File "/app/.venv/lib/python3.11/site-packages/click/core.py", line 783, in 
invoke
       return __callback(*args, **kwargs)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File "/app/.venv/lib/python3.11/site-packages/click/decorators.py", line 
33, in new_func
       return f(get_current_context(), *args, **kwargs)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File "/app/.venv/lib/python3.11/site-packages/flask/cli.py", line 358, in 
decorator
       return __ctx.invoke(f, *args, **kwargs)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File "/app/.venv/lib/python3.11/site-packages/click/core.py", line 783, in 
invoke
       return __callback(*args, **kwargs)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File "/app/.venv/lib/python3.11/site-packages/flask_migrate/cli.py", line 
149, in upgrade
       _upgrade(directory, revision, sql, tag, x_arg)
     File "/app/.venv/lib/python3.11/site-packages/flask_migrate/__init__.py", 
line 98, in wrapped
       f(*args, **kwargs)
     File "/app/.venv/lib/python3.11/site-packages/flask_migrate/__init__.py", 
line 185, in upgrade
       command.upgrade(config, revision, sql=sql, tag=tag)
     File "/app/.venv/lib/python3.11/site-packages/alembic/command.py", line 
406, in upgrade
       script.run_env()
     File "/app/.venv/lib/python3.11/site-packages/alembic/script/base.py", 
line 586, in run_env
       util.load_python_file(self.dir, "env.py")
     File "/app/.venv/lib/python3.11/site-packages/alembic/util/pyfiles.py", 
line 95, in load_python_file
       module = load_module_py(module_id, path)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File "/app/.venv/lib/python3.11/site-packages/alembic/util/pyfiles.py", 
line 113, in load_module_py
       spec.loader.exec_module(module)  # type: ignore
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File "<frozen importlib._bootstrap_external>", line 940, in exec_module
     File "<frozen importlib._bootstrap>", line 241, in 
_call_with_frames_removed
     File 
"/app/.venv/lib/python3.11/site-packages/superset/extensions/../migrations/env.py",
 line 142, in <module>
       run_migrations_online()
     File 
"/app/.venv/lib/python3.11/site-packages/superset/extensions/../migrations/env.py",
 line 133, in run_migrations_online
       context.run_migrations()
     File "<string>", line 8, in run_migrations
     File 
"/app/.venv/lib/python3.11/site-packages/alembic/runtime/environment.py", line 
946, in run_migrations
       self.get_context().run_migrations(**kw)
     File 
"/app/.venv/lib/python3.11/site-packages/alembic/runtime/migration.py", line 
623, in run_migrations
       step.migration_fn(**kw)
     File 
"/app/.venv/lib/python3.11/site-packages/superset/migrations/versions/2015-09-21_17-30_4e6a06bad7a8_init.py",
 line 57, in upgrade
       op.create_table(
     File "<string>", line 8, in create_table
     File "<string>", line 3, in create_table
     File "/app/.venv/lib/python3.11/site-packages/alembic/operations/ops.py", 
line 1318, in create_table
       return operations.invoke(op)
              ^^^^^^^^^^^^^^^^^^^^^
     File "/app/.venv/lib/python3.11/site-packages/alembic/operations/base.py", 
line 442, in invoke
       return fn(self, operation)
              ^^^^^^^^^^^^^^^^^^^
     File 
"/app/.venv/lib/python3.11/site-packages/alembic/operations/toimpl.py", line 
143, in create_table
       operations.impl.create_table(table, **kw)
     File "/app/.venv/lib/python3.11/site-packages/alembic/ddl/impl.py", line 
406, in create_table
       self._exec(schema.CreateTable(table, **kw))
     File "/app/.venv/lib/python3.11/site-packages/alembic/ddl/impl.py", line 
247, in _exec
       return conn.execute(construct, params)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File "/app/.venv/lib/python3.11/site-packages/sqlalchemy/engine/base.py", 
line 1385, in execute
       return meth(self, multiparams, params, _EMPTY_EXECUTION_OPTS)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File "/app/.venv/lib/python3.11/site-packages/sqlalchemy/sql/ddl.py", line 
80, in _execute_on_connection
       return connection._execute_ddl(
              ^^^^^^^^^^^^^^^^^^^^^^^^
     File "/app/.venv/lib/python3.11/site-packages/sqlalchemy/engine/base.py", 
line 1477, in _execute_ddl
       ret = self._execute_context(
             ^^^^^^^^^^^^^^^^^^^^^^
     File "/app/.venv/lib/python3.11/site-packages/sqlalchemy/engine/base.py", 
line 1953, in _execute_context
       self._handle_dbapi_exception(
     File "/app/.venv/lib/python3.11/site-packages/sqlalchemy/engine/base.py", 
line 2134, in _handle_dbapi_exception
       util.raise_(
     File "/app/.venv/lib/python3.11/site-packages/sqlalchemy/util/compat.py", 
line 211, in raise_
       raise exception
     File "/app/.venv/lib/python3.11/site-packages/sqlalchemy/engine/base.py", 
line 1910, in _execute_context
       self.dialect.do_execute(
     File 
"/app/.venv/lib/python3.11/site-packages/sqlalchemy/engine/default.py", line 
736, in do_execute
       cursor.execute(statement, parameters)
   sqlalchemy.exc.ProgrammingError: (psycopg2.errors.DuplicateTable) relation 
"dashboards" already exists
   
   [SQL:
   CREATE TABLE dashboards (
        created_on TIMESTAMP WITHOUT TIME ZONE NOT NULL,
        changed_on TIMESTAMP WITHOUT TIME ZONE NOT NULL,
        id SERIAL NOT NULL,
        dashboard_title VARCHAR(500),
        position_json TEXT,
        created_by_fk INTEGER,
        changed_by_fk INTEGER,
        PRIMARY KEY (id),
        FOREIGN KEY(created_by_fk) REFERENCES ab_user (id),
        FOREIGN KEY(changed_by_fk) REFERENCES ab_user (id)
   )
   
   ]
   (Background on this error at: https://sqlalche.me/e/14/f405)
   
   ### Screenshots/recordings
   
   _No response_
   
   ### Superset version
   
   5.0.0
   
   ### Python version
   
   3.11
   
   ### Node version
   
   18 or greater
   
   ### 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.


-- 
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