You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2021/02/09 17:47:13 UTC

[GitHub] [superset] gemif opened a new issue #13033: Superset Upgrade from v 0.38 to v 1.0.1 DB Upgrade Exception

gemif opened a new issue #13033:
URL: https://github.com/apache/superset/issues/13033


   Hi there, I want to to upgrade superset from version 0.38 to 1.0.1. My database is in PostgreSQL, but when I tried to run superset db upgrade command, I've got the following error:
   
   superset db upgrade
   Loaded your LOCAL configuration at [/home/flaskuser/venv/lib/python3.7/site-packages/superset_config.py]
   logging was configured successfully
   INFO:superset.utils.logging_configurator:logging was configured successfully
   /home/flaskuser/venv/lib/python3.7/site-packages/flask_caching/__init__.py:189: UserWarning: Flask-Caching: CACHE_TYPE is set to null, caching is effectively disabled.
     "Flask-Caching: CACHE_TYPE is set to null, "
   INFO  [alembic.runtime.migration] Context impl PostgresqlImpl.
   INFO  [alembic.runtime.migration] Will assume transactional DDL.
   INFO  [alembic.runtime.migration] Running upgrade 18532d70ab98 -> b56500de1855, add_uuid_column_to_import_mixin
   
   Adding uuids for `dbs`...
   Done. Assigned 2 uuids in 0.021s.
   
   Adding uuids for `dashboards`...
   Done. Assigned 24 uuids in 0.001s.
   
   Adding uuids for `slices`...
   Done. Assigned 724 uuids in 0.069s.
   
   Adding uuids for `tables`...
   Done. Assigned 173 uuids in 0.034s.
   
   Adding uuids for `table_columns`...
   Done. Assigned 2409 uuids in 0.126s.
   
   Adding uuids for `sql_metrics`...
   Done. Assigned 162 uuids in 0.008s.
   
   Adding uuids for `dashboard_email_schedules`...
   Done. Assigned 1 uuids in 0.001s.
   
   Adding uuids for `slice_email_schedules`...
   Done. Assigned 1 uuids in 0.001s.
   
   Updating dasboard position json with slice uuid.. Done.      
   
   INFO  [alembic.runtime.migration] Running upgrade b56500de1855 -> af30ca79208f, Collapse alerting models into a single one
   Traceback (most recent call last):
     File "/home/flaskuser/venv/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1284, in _execute_context
       cursor, statement, parameters, context
     File "/home/flaskuser/venv/lib/python3.7/site-packages/sqlalchemy/engine/default.py", line 590, in do_execute
       cursor.execute(statement, parameters)
   psycopg2.errors.NotNullViolation: column "database_id" contains null values
   
   The above exception was the direct cause of the following exception:
   
   Traceback (most recent call last):
     File "/home/flaskuser/venv/bin/superset", line 11, in <module>
       load_entry_point('apache-superset==1.0.1', 'console_scripts', 'superset')()
     File "/home/flaskuser/venv/lib/python3.7/site-packages/click/core.py", line 829, in __call__
       return self.main(*args, **kwargs)
     File "/home/flaskuser/venv/lib/python3.7/site-packages/flask/cli.py", line 586, in main
       return super(FlaskGroup, self).main(*args, **kwargs)
     File "/home/flaskuser/venv/lib/python3.7/site-packages/click/core.py", line 782, in main
       rv = self.invoke(ctx)
     File "/home/flaskuser/venv/lib/python3.7/site-packages/click/core.py", line 1259, in invoke
       return _process_result(sub_ctx.command.invoke(sub_ctx))
     File "/home/flaskuser/venv/lib/python3.7/site-packages/click/core.py", line 1259, in invoke
       return _process_result(sub_ctx.command.invoke(sub_ctx))
     File "/home/flaskuser/venv/lib/python3.7/site-packages/click/core.py", line 1066, in invoke
       return ctx.invoke(self.callback, **ctx.params)
     File "/home/flaskuser/venv/lib/python3.7/site-packages/click/core.py", line 610, in invoke
       return callback(*args, **kwargs)
     File "/home/flaskuser/venv/lib/python3.7/site-packages/click/decorators.py", line 21, in new_func
       return f(get_current_context(), *args, **kwargs)
     File "/home/flaskuser/venv/lib/python3.7/site-packages/flask/cli.py", line 426, in decorator
       return __ctx.invoke(f, *args, **kwargs)
     File "/home/flaskuser/venv/lib/python3.7/site-packages/click/core.py", line 610, in invoke
       return callback(*args, **kwargs)
     File "/home/flaskuser/venv/lib/python3.7/site-packages/flask_migrate/cli.py", line 134, in upgrade
       _upgrade(directory, revision, sql, tag, x_arg)
     File "/home/flaskuser/venv/lib/python3.7/site-packages/flask_migrate/__init__.py", line 96, in wrapped
       f(*args, **kwargs)
     File "/home/flaskuser/venv/lib/python3.7/site-packages/flask_migrate/__init__.py", line 271, in upgrade
       command.upgrade(config, revision, sql=sql, tag=tag)
     File "/home/flaskuser/venv/lib/python3.7/site-packages/alembic/command.py", line 298, in upgrade
       script.run_env()
     File "/home/flaskuser/venv/lib/python3.7/site-packages/alembic/script/base.py", line 489, in run_env
       util.load_python_file(self.dir, "env.py")
     File "/home/flaskuser/venv/lib/python3.7/site-packages/alembic/util/pyfiles.py", line 98, in load_python_file
       module = load_module_py(module_id, path)
     File "/home/flaskuser/venv/lib/python3.7/site-packages/alembic/util/compat.py", line 184, in load_module_py
       spec.loader.exec_module(module)
     File "<frozen importlib._bootstrap_external>", line 728, in exec_module
     File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
     File "/home/flaskuser/venv/lib/python3.7/site-packages/superset/migrations/env.py", line 124, in <module>
       run_migrations_online()
     File "/home/flaskuser/venv/lib/python3.7/site-packages/superset/migrations/env.py", line 116, in run_migrations_online
       context.run_migrations()
     File "<string>", line 8, in run_migrations
     File "/home/flaskuser/venv/lib/python3.7/site-packages/alembic/runtime/environment.py", line 846, in run_migrations
       self.get_context().run_migrations(**kw)
     File "/home/flaskuser/venv/lib/python3.7/site-packages/alembic/runtime/migration.py", line 520, in run_migrations
       step.migration_fn(**kw)
     File "/home/flaskuser/venv/lib/python3.7/site-packages/superset/migrations/versions/af30ca79208f_collapse_alerting_models_into_a_single_.py", line 121, in upgrade
       "alerts", sa.Column("database_id", sa.Integer(), default=0, nullable=False),
     File "<string>", line 8, in add_column
     File "<string>", line 3, in add_column
     File "/home/flaskuser/venv/lib/python3.7/site-packages/alembic/operations/ops.py", line 1929, in add_column
       return operations.invoke(op)
     File "/home/flaskuser/venv/lib/python3.7/site-packages/alembic/operations/base.py", line 374, in invoke
       return fn(self, operation)
     File "/home/flaskuser/venv/lib/python3.7/site-packages/alembic/operations/toimpl.py", line 132, in add_column
       operations.impl.add_column(table_name, column, schema=schema, **kw)
     File "/home/flaskuser/venv/lib/python3.7/site-packages/alembic/ddl/impl.py", line 237, in add_column
       self._exec(base.AddColumn(table_name, column, schema=schema))
     File "/home/flaskuser/venv/lib/python3.7/site-packages/alembic/ddl/impl.py", line 140, in _exec
       return conn.execute(construct, *multiparams, **params)
     File "/home/flaskuser/venv/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1020, in execute
       return meth(self, multiparams, params)
     File "/home/flaskuser/venv/lib/python3.7/site-packages/sqlalchemy/sql/ddl.py", line 72, in _execute_on_connection
       return connection._execute_ddl(self, multiparams, params)
     File "/home/flaskuser/venv/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1082, in _execute_ddl
       compiled,
     File "/home/flaskuser/venv/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1324, in _execute_context
       e, statement, parameters, cursor, context
     File "/home/flaskuser/venv/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1518, in _handle_dbapi_exception
       sqlalchemy_exception, with_traceback=exc_info[2], from_=e
     File "/home/flaskuser/venv/lib/python3.7/site-packages/sqlalchemy/util/compat.py", line 178, in raise_
       raise exception
     File "/home/flaskuser/venv/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1284, in _execute_context
       cursor, statement, parameters, context
     File "/home/flaskuser/venv/lib/python3.7/site-packages/sqlalchemy/engine/default.py", line 590, in do_execute
       cursor.execute(statement, parameters)
   sqlalchemy.exc.IntegrityError: (psycopg2.errors.NotNullViolation) column "database_id" contains null values
   
   [SQL: ALTER TABLE alerts ADD COLUMN database_id INTEGER NOT NULL]
   (Background on this error at: http://sqlalche.me/e/gkpj)
   
   Please, any idea to correct this? Any sql script to adjust de DB? A clear and concise description of what the bug is.
   
   - superset version:  0.38
   - python version:  3.7.3
   - sqlalchemy version: 1.3.17


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] ITStitch commented on issue #13033: Superset Upgrade from v 0.38 to v 1.0.1 DB Upgrade Exception

Posted by GitBox <gi...@apache.org>.
ITStitch commented on issue #13033:
URL: https://github.com/apache/superset/issues/13033#issuecomment-778429216


   Hi @nytai, thanks for your reply. Following yours comments, I erased de alerts and the dashboards emails, and then the update script run correctly. The issue was solved, thank you very much.


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] amitmiran137 closed issue #13033: Superset Upgrade from v 0.38 to v 1.0.1 DB Upgrade Exception

Posted by GitBox <gi...@apache.org>.
amitmiran137 closed issue #13033:
URL: https://github.com/apache/superset/issues/13033


   


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] nytai commented on issue #13033: Superset Upgrade from v 0.38 to v 1.0.1 DB Upgrade Exception

Posted by GitBox <gi...@apache.org>.
nytai commented on issue #13033:
URL: https://github.com/apache/superset/issues/13033#issuecomment-776222980


   @ITStitch This migration is trying to merge the alerts models into a single one. Looks like your db has some records that violate the new uniqueness constraints on the new models. I suspect you have various alerts records that have an empty `database_id` field. I'd suggest you delete those records and attempt the migration again.   


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] nytai edited a comment on issue #13033: Superset Upgrade from v 0.38 to v 1.0.1 DB Upgrade Exception

Posted by GitBox <gi...@apache.org>.
nytai edited a comment on issue #13033:
URL: https://github.com/apache/superset/issues/13033#issuecomment-776222980


   @ITStitch This migration is trying to merge the old alerts models into a the new models. We recently rewrote the alerts and reports feature. Looks like your db has some records that violate the new uniqueness constraints on the new models. I suspect you have various alerts records that have an empty `database_id` field. I'd suggest you delete those records and attempt the migration again.   


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] nytai edited a comment on issue #13033: Superset Upgrade from v 0.38 to v 1.0.1 DB Upgrade Exception

Posted by GitBox <gi...@apache.org>.
nytai edited a comment on issue #13033:
URL: https://github.com/apache/superset/issues/13033#issuecomment-776222980


   @ITStitch This migration is trying to merge the old alerts models into a the new models. Looks like your db has some records that violate the new uniqueness constraints on the new models. I suspect you have various alerts records that have an empty `database_id` field. I'd suggest you delete those records and attempt the migration again.   


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org