Skip to content
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

OperationalError: (sqlite3.OperationalError) no such column: dbs.impersonate_user #4142

Closed
hsebastian opened this issue Jan 2, 2018 · 11 comments
Labels
inactive Inactive for >= 30 days

Comments

@hsebastian
Copy link

hsebastian commented Jan 2, 2018

Please help!

Make sure these boxes are checked before submitting your issue - thank you!

  • [ yes ] I have checked the superset logs for python stacktraces and included it here as text if any
  • [ yes ] I have reproduced the issue with at least the latest released version of superset
  • [ yes ] I have checked the issue tracker for the same issue and I haven't found one similar

I looked at a similar issue #3517 However, I don't understand how it was fixed.

Superset version

~# pip freeze | grep superset
superset==0.22.1

Expected results

A webpage displaying a list of Tables.

Actual results

Exception on /tablemodelview/list/ [GET]
Traceback (most recent call last):
  File "/home/ubuntu/work/venv/local/lib/python2.7/site-packages/flask/app.py", line 1982, in wsgi_app
    response = self.full_dispatch_request()
  File "/home/ubuntu/work/venv/local/lib/python2.7/site-packages/flask/app.py", line 1614, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/home/ubuntu/work/venv/local/lib/python2.7/site-packages/flask/app.py", line 1517, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/home/ubuntu/work/venv/local/lib/python2.7/site-packages/flask/app.py", line 1612, in full_dispatch_request
    rv = self.dispatch_request()
  File "/home/ubuntu/work/venv/local/lib/python2.7/site-packages/flask/app.py", line 1598, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/home/ubuntu/work/venv/local/lib/python2.7/site-packages/flask_appbuilder/security/decorators.py", line 26, in wraps
    return f(self, *args, **kwargs)
  File "/home/ubuntu/work/venv/local/lib/python2.7/site-packages/flask_appbuilder/views.py", line 478, in list
    widgets=widgets)
  File "/home/ubuntu/work/venv/local/lib/python2.7/site-packages/flask_appbuilder/baseviews.py", line 158, in render_template
    return render_template(template, **dict(list(kwargs.items()) + list(self.extra_args.items())))
  File "/home/ubuntu/work/venv/local/lib/python2.7/site-packages/flask/templating.py", line 134, in render_template
    context, ctx.app)
  File "/home/ubuntu/work/venv/local/lib/python2.7/site-packages/flask/templating.py", line 116, in _render
    rv = template.render(context)
  File "/home/ubuntu/work/venv/local/lib/python2.7/site-packages/jinja2/environment.py", line 1008, in render
    return self.environment.handle_exception(exc_info, True)
  File "/home/ubuntu/work/venv/local/lib/python2.7/site-packages/jinja2/environment.py", line 780, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/home/ubuntu/work/venv/local/lib/python2.7/site-packages/superset/templates/appbuilder/general/model/list.html", line 2, in top-level template code
    {% import 'appbuilder/general/lib.html' as lib %}
  File "/home/ubuntu/work/venv/local/lib/python2.7/site-packages/flask_appbuilder/templates/appbuilder/base.html", line 1, in top-level template code
    {% extends base_template %}
  File "/home/ubuntu/work/venv/local/lib/python2.7/site-packages/superset/templates/superset/base.html", line 1, in top-level template code
    {% extends "appbuilder/baselayout.html" %}
  File "/home/ubuntu/work/venv/local/lib/python2.7/site-packages/superset/templates/appbuilder/baselayout.html", line 2, in top-level template code
    {% import 'appbuilder/baselib.html' as baselib %}
  File "/home/ubuntu/work/venv/local/lib/python2.7/site-packages/flask_appbuilder/templates/appbuilder/init.html", line 46, in top-level template code
    {% block body %}
  File "/home/ubuntu/work/venv/local/lib/python2.7/site-packages/superset/templates/appbuilder/baselayout.html", line 21, in block "body"
    {% block content %}
  File "/home/ubuntu/work/venv/local/lib/python2.7/site-packages/superset/templates/appbuilder/general/model/list.html", line 8, in block "content"
    {% block list_search scoped %}
  File "/home/ubuntu/work/venv/local/lib/python2.7/site-packages/superset/templates/appbuilder/general/model/list.html", line 9, in block "list_search"
    {{ widgets.get('search')()|safe }}
  File "/home/ubuntu/work/venv/local/lib/python2.7/site-packages/flask_appbuilder/widgets.py", line 108, in __call__
    form_fields[col] = self.template_args['form'][col]()
  File "/home/ubuntu/work/venv/local/lib/python2.7/site-packages/wtforms/fields/core.py", line 153, in __call__
    return self.meta.render_field(self, kwargs)
  File "/home/ubuntu/work/venv/local/lib/python2.7/site-packages/wtforms/meta.py", line 56, in render_field
    return field.widget(field, **render_kw)
  File "/home/ubuntu/work/venv/local/lib/python2.7/site-packages/flask_appbuilder/fieldwidgets.py", line 156, in __call__
    return super(Select2Widget, self).__call__(field, **kwargs)
  File "/home/ubuntu/work/venv/local/lib/python2.7/site-packages/wtforms/widgets/core.py", line 287, in __call__
    for val, label, selected in field.iter_choices():
  File "/home/ubuntu/work/venv/local/lib/python2.7/site-packages/flask_appbuilder/fields.py", line 113, in iter_choices
    for pk, obj in self._get_object_list():
  File "/home/ubuntu/work/venv/local/lib/python2.7/site-packages/flask_appbuilder/fields.py", line 105, in _get_object_list
    objs = self.query_func()
  File "/home/ubuntu/work/venv/local/lib/python2.7/site-packages/flask_appbuilder/forms.py", line 114, in <lambda>
    return lambda: self.datamodel.get_related_interface(col_name).query()[1]
  File "/home/ubuntu/work/venv/local/lib/python2.7/site-packages/flask_appbuilder/models/sqla/interface.py", line 118, in query
    return count, query.all()
  File "/home/ubuntu/work/venv/local/lib/python2.7/site-packages/sqlalchemy/orm/query.py", line 2703, in all
    return list(self)
  File "/home/ubuntu/work/venv/local/lib/python2.7/site-packages/sqlalchemy/orm/query.py", line 2855, in __iter__
    return self._execute_and_instances(context)
  File "/home/ubuntu/work/venv/local/lib/python2.7/site-packages/sqlalchemy/orm/query.py", line 2878, in _execute_and_instances
    result = conn.execute(querycontext.statement, self._params)
  File "/home/ubuntu/work/venv/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 945, in execute
    return meth(self, multiparams, params)
  File "/home/ubuntu/work/venv/local/lib/python2.7/site-packages/sqlalchemy/sql/elements.py", line 263, in _execute_on_connection
    return connection._execute_clauseelement(self, multiparams, params)
  File "/home/ubuntu/work/venv/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1053, in _execute_clauseelement
    compiled_sql, distilled_params
  File "/home/ubuntu/work/venv/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1189, in _execute_context
    context)
  File "/home/ubuntu/work/venv/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1402, in _handle_dbapi_exception
    exc_info
  File "/home/ubuntu/work/venv/local/lib/python2.7/site-packages/sqlalchemy/util/compat.py", line 203, in raise_from_cause
    reraise(type(exception), exception, tb=exc_tb, cause=cause)
  File "/home/ubuntu/work/venv/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1182, in _execute_context
    context)
  File "/home/ubuntu/work/venv/local/lib/python2.7/site-packages/sqlalchemy/engine/default.py", line 470, in do_execute
    cursor.execute(statement, parameters)
OperationalError: (sqlite3.OperationalError) no such column: dbs.impersonate_user [SQL: u'SELECT dbs.created_on AS dbs_created_on, dbs.changed_on AS dbs_changed_on, dbs.id AS dbs_id, dbs.verbose_name AS dbs_verbose_name, dbs.database_name AS dbs_database_name, dbs.sqlalchemy_uri AS dbs_sqlalchemy_uri, dbs.password AS dbs_password, dbs.cache_timeout AS dbs_cache_timeout, dbs.select_as_create_table_as AS dbs_select_as_create_table_as, dbs.expose_in_sqllab AS dbs_expose_in_sqllab, dbs.allow_run_sync AS dbs_allow_run_sync, dbs.allow_run_async AS dbs_allow_run_async, dbs.allow_ctas AS dbs_allow_ctas, dbs.allow_dml AS dbs_allow_dml, dbs.force_ctas_schema AS dbs_force_ctas_schema, dbs.extra AS dbs_extra, dbs.perm AS dbs_perm, dbs.impersonate_user AS dbs_impersonate_user, dbs.changed_by_fk AS dbs_changed_by_fk, dbs.created_by_fk AS dbs_created_by_fk \nFROM dbs']

Steps to reproduce

Just today, a co-worker reported a 500 internal server error running a query in SQL lab.

[2017-12-15 14:13:00,752] ERROR in app: Exception on /superset/sql_json/ [POST]
Traceback (most recent call last):
  File "/home/ubuntu/work/venv/local/lib/python2.7/site-packages/flask/app.py", line 1982, in wsgi_app
    response = self.full_dispatch_request()
  File "/home/ubuntu/work/venv/local/lib/python2.7/site-packages/flask/app.py", line 1614, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/home/ubuntu/work/venv/local/lib/python2.7/site-packages/flask/app.py", line 1517, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/home/ubuntu/work/venv/local/lib/python2.7/site-packages/flask/app.py", line 1612, in full_dispatch_request
    rv = self.dispatch_request()
  File "/home/ubuntu/work/venv/local/lib/python2.7/site-packages/flask/app.py", line 1598, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/home/ubuntu/work/venv/local/lib/python2.7/site-packages/flask_appbuilder/security/decorators.py", line 52, in wraps
    return f(self, *args, **kwargs)
  File "/home/ubuntu/work/venv/local/lib/python2.7/site-packages/superset/models/core.py", line 759, in wrapper
    value = f(*args, **kwargs)
  File "/home/ubuntu/work/venv/local/lib/python2.7/site-packages/superset/views/core.py", line 2075, in sql_json
    if data.get('status') == QueryStatus.FAILED:
AttributeError: 'NoneType' object has no attribute 'get'

Attempting to fix the AttributeError issue by upgrading, I decided to upgrade but I have this no such column: dbs.impersonate_user issue now.

I upgraded following the steps here: https://superset.incubator.apache.org/installation.html#upgrading

pip install --upgrade superset
superset db upgrade
superset init

I did get some errors and warnings when running db upgrade.

superset db upgrade
2018-01-03 01:02:03,611:ERROR:flask_appbuilder.security.sqla.manager:Remove Permission from View Error: 'list' object has no attribute 'permission'
INFO  [alembic.runtime.migration] Context impl SQLiteImpl.
INFO  [alembic.runtime.migration] Will assume transactional DDL.
INFO  [alembic.runtime.migration] Running upgrade  -> 4e6a06bad7a8, Init
INFO  [alembic.runtime.migration] Running upgrade 4e6a06bad7a8 -> 5a7bad26f2a7, empty message
INFO  [alembic.runtime.migration] Running upgrade 5a7bad26f2a7 -> 1e2841a4128, empty message
INFO  [alembic.runtime.migration] Running upgrade 1e2841a4128 -> 2929af7925ed, TZ offsets in data sources
INFO  [alembic.runtime.migration] Running upgrade 2929af7925ed -> 289ce07647b, Add encrypted password field
INFO  [alembic.runtime.migration] Running upgrade 289ce07647b -> 1a48a5411020, adding slug to dash
INFO  [alembic.runtime.migration] Running upgrade 1a48a5411020 -> 315b3f4da9b0, adding log model
INFO  [alembic.runtime.migration] Running upgrade 315b3f4da9b0 -> 55179c7f25c7, sqla_descr
INFO  [alembic.runtime.migration] Running upgrade 55179c7f25c7 -> 12d55656cbca, is_featured
/home/ubuntu/work/venv/local/lib/python2.7/site-packages/alembic/util/messaging.py:69: UserWarning: Skipping unsupported ALTER for creation of implicit constraint
  warnings.warn(msg)
INFO  [alembic.runtime.migration] Running upgrade 12d55656cbca -> 2591d77e9831, user_id
INFO  [alembic.runtime.migration] Running upgrade 2591d77e9831 -> 8e80a26a31db, empty message
INFO  [alembic.runtime.migration] Running upgrade 8e80a26a31db -> 7dbf98566af7, empty message
INFO  [alembic.runtime.migration] Running upgrade 7dbf98566af7 -> 43df8de3a5f4, empty message
INFO  [alembic.runtime.migration] Running upgrade 43df8de3a5f4 -> d827694c7555, css templates
INFO  [alembic.runtime.migration] Running upgrade d827694c7555 -> 430039611635, log more
INFO  [alembic.runtime.migration] Running upgrade 430039611635 -> 18e88e1cc004, making audit nullable
INFO  [alembic.runtime.migration] Running upgrade 18e88e1cc004 -> 836c0bf75904, cache_timeouts
INFO  [alembic.runtime.migration] Running upgrade 18e88e1cc004 -> a2d606a761d9, adding favstar model
INFO  [alembic.runtime.migration] Running upgrade a2d606a761d9, 836c0bf75904 -> d2424a248d63, empty message
INFO  [alembic.runtime.migration] Running upgrade d2424a248d63 -> 763d4b211ec9, fixing audit fk
INFO  [alembic.runtime.migration] Running upgrade d2424a248d63 -> 1d2ddd543133, log dt
INFO  [alembic.runtime.migration] Running upgrade 1d2ddd543133, 763d4b211ec9 -> fee7b758c130, empty message
INFO  [alembic.runtime.migration] Running upgrade fee7b758c130 -> 867bf4f117f9, Adding extra field to Database model
INFO  [alembic.runtime.migration] Running upgrade 867bf4f117f9 -> bb51420eaf83, add schema to table model
INFO  [alembic.runtime.migration] Running upgrade bb51420eaf83 -> b4456560d4f3, change_table_unique_constraint
INFO  [alembic.runtime.migration] Running upgrade b4456560d4f3 -> 4fa88fe24e94, owners_many_to_many
INFO  [alembic.runtime.migration] Running upgrade 4fa88fe24e94 -> c3a8f8611885, Materializing permission
INFO  [alembic.runtime.migration] Running upgrade c3a8f8611885 -> f0fbf6129e13, Adding verbose_name to tablecolumn
INFO  [alembic.runtime.migration] Running upgrade f0fbf6129e13 -> 956a063c52b3, adjusting key length
INFO  [alembic.runtime.migration] Running upgrade 956a063c52b3 -> 1226819ee0e3, Fix wrong constraint on table columns
WARNI [root] Could not find or drop constraint on `columns`
INFO  [alembic.runtime.migration] Running upgrade 1226819ee0e3 -> d8bc074f7aad, Add new field 'is_restricted' to SqlMetric and DruidMetric
INFO  [alembic.runtime.migration] Running upgrade d8bc074f7aad -> 27ae655e4247, Make creator owners
INFO  [alembic.runtime.migration] Running upgrade 27ae655e4247 -> 960c69cb1f5b, add dttm_format related fields in table_columns
INFO  [alembic.runtime.migration] Running upgrade 960c69cb1f5b -> f162a1dea4c4, d3format_by_metric
INFO  [alembic.runtime.migration] Running upgrade f162a1dea4c4 -> ad82a75afd82, Update models to support storing the queries.
INFO  [alembic.runtime.migration] Running upgrade ad82a75afd82 -> 3c3ffe173e4f, add_sql_string_to_table
INFO  [alembic.runtime.migration] Running upgrade 3c3ffe173e4f -> 41f6a59a61f2, database options for sql lab
INFO  [alembic.runtime.migration] Running upgrade 41f6a59a61f2 -> 4500485bde7d, allow_run_sync_async
INFO  [alembic.runtime.migration] Running upgrade 4500485bde7d -> 65903709c321, allow_dml
INFO  [alembic.runtime.migration] Running upgrade 41f6a59a61f2 -> 33d996bcc382
INFO  [alembic.runtime.migration] Running upgrade 33d996bcc382, 65903709c321 -> b347b202819b, empty message
INFO  [alembic.runtime.migration] Running upgrade b347b202819b -> 5e4a03ef0bf0, Add access_request table to manage requests to access datastores.
INFO  [alembic.runtime.migration] Running upgrade 5e4a03ef0bf0 -> eca4694defa7, sqllab_setting_defaults
INFO  [alembic.runtime.migration] Running upgrade eca4694defa7 -> ab3d66c4246e, add_cache_timeout_to_druid_cluster
INFO  [alembic.runtime.migration] Running upgrade eca4694defa7 -> 3b626e2a6783, Sync DB with the models.py.
WARNI [root] No such constraint: 'slices_ibfk_1'
WARNI [root] Constraint must have a name
WARNI [root] No such index: 'table_name'
INFO  [alembic.runtime.migration] Running upgrade 3b626e2a6783, ab3d66c4246e -> ef8843b41dac, empty message
INFO  [alembic.runtime.migration] Running upgrade ef8843b41dac -> b46fa1b0b39e, Add json_metadata to the tables table.
INFO  [alembic.runtime.migration] Running upgrade b46fa1b0b39e -> 7e3ddad2a00b, results_key to query
INFO  [alembic.runtime.migration] Running upgrade 7e3ddad2a00b -> ad4d656d92bc, Add avg() to default metrics
INFO  [alembic.runtime.migration] Running upgrade ad4d656d92bc -> c611f2b591b8, dim_spec
INFO  [alembic.runtime.migration] Running upgrade c611f2b591b8 -> e46f2d27a08e, materialize perms
INFO  [alembic.runtime.migration] Running upgrade e46f2d27a08e -> f1f2d4af5b90, Enable Filter Select
INFO  [alembic.runtime.migration] Running upgrade e46f2d27a08e -> 525c854f0005, log_this_plus
INFO  [alembic.runtime.migration] Running upgrade 525c854f0005, f1f2d4af5b90 -> 6414e83d82b7, empty message
INFO  [alembic.runtime.migration] Running upgrade 6414e83d82b7 -> 1296d28ec131, Adds params to the datasource (druid) table
INFO  [alembic.runtime.migration] Running upgrade 1296d28ec131 -> f18570e03440, Add index on the result key to the query table.
INFO  [alembic.runtime.migration] Running upgrade f18570e03440 -> bcf3126872fc, Add keyvalue table
INFO  [alembic.runtime.migration] Running upgrade f18570e03440 -> db0c65b146bd, update_slice_model_json
INFO  [alembic.runtime.migration] Running upgrade db0c65b146bd -> a99f2f7c195a, rewriting url from shortner with new format
INFO  [alembic.runtime.migration] Running upgrade a99f2f7c195a, bcf3126872fc -> d6db5a5cdb5d, empty message
INFO  [alembic.runtime.migration] Running upgrade d6db5a5cdb5d -> b318dfe5fb6c, adding verbose_name to druid column
INFO  [alembic.runtime.migration] Running upgrade d6db5a5cdb5d -> 732f1c06bcbf, add fetch values predicate
INFO  [alembic.runtime.migration] Running upgrade 732f1c06bcbf, b318dfe5fb6c -> ea033256294a, empty message
INFO  [alembic.runtime.migration] Running upgrade b318dfe5fb6c -> db527d8c4c78, Add verbose name to DruidCluster and Database
INFO  [alembic.runtime.migration] Running upgrade db527d8c4c78, ea033256294a -> 979c03af3341, empty message
INFO  [alembic.runtime.migration] Running upgrade 979c03af3341 -> a6c18f869a4e, query.start_running_time
INFO  [alembic.runtime.migration] Running upgrade a6c18f869a4e -> 2fcdcb35e487, saved_queries
INFO  [alembic.runtime.migration] Running upgrade 2fcdcb35e487 -> a65458420354, add_result_backend_time_logging
INFO  [alembic.runtime.migration] Running upgrade a65458420354 -> ca69c70ec99b, tracking_url
INFO  [alembic.runtime.migration] Running upgrade ca69c70ec99b -> a9c47e2c1547, add impersonate_user to dbs
INFO  [alembic.runtime.migration] Running upgrade ca69c70ec99b -> ddd6ebdd853b, annotations
INFO  [alembic.runtime.migration] Running upgrade a9c47e2c1547, ddd6ebdd853b -> d39b1e37131d, empty message
INFO  [alembic.runtime.migration] Running upgrade ca69c70ec99b -> 19a814813610, Adding metric warning_text
INFO  [alembic.runtime.migration] Running upgrade 19a814813610, a9c47e2c1547 -> 472d2f73dfd4, empty message
INFO  [alembic.runtime.migration] Running upgrade 472d2f73dfd4, d39b1e37131d -> f959a6652acd, empty message
INFO  [alembic.runtime.migration] Running upgrade f959a6652acd -> 4736ec66ce19, empty message
/home/ubuntu/work/venv/local/lib/python2.7/site-packages/sqlalchemy/dialects/sqlite/base.py:1427: SAWarning: WARNING: SQL-parsed foreign key constraint '(u'datasource_name', u'datasources', u'datasource_name')' could not be located in PRAGMA foreign_keys for table metrics
  table_name
@xrmx
Copy link
Contributor

xrmx commented Jan 2, 2018

The first error is usually you upgrading superset but forgiving to run the migrations to update the db. The second looks like something that should have been fixed by #3111

@hsebastian
Copy link
Author

hi @xrmx thanks for looking into this. Like I mentioned before, I did run superset db upgrade and superset init. Is this sufficient for migrations?

Are you saying that my version does not have the #3111 fix ?

@mistercrunch
Copy link
Member

The migration you are missing somehow is INFO [alembic.runtime.migration] Running upgrade ca69c70ec99b -> a9c47e2c1547, add impersonate_user to dbs. One way to troubleshoot this would be to downgrade your way back there and re-run it.

@hsebastian
Copy link
Author

hsebastian commented Jan 3, 2018

@mistercrunch looking at the migration output I pasted above, I do see the migration you're talking about (the 7th migration from the bottom). Are you saying I find the version that comes with that migration, downgrade to it, and re-run the migration?

@hsebastian
Copy link
Author

hsebastian commented Jan 3, 2018

I uninstalled superset and re-installed 0.19.1 with pip.

# pip freeze | grep superset
superset==0.19.1

When I run superset db upgrade, I get.

OR:flask_appbuilder.security.sqla.manager:Remove Permission from View Error: 'list' object has no attribute 'permission'
2018-01-03 12:01:49,128:ERROR:flask_appbuilder.security.sqla.manager:Remove Permission from View Error: 'list' object has no attribute 'permission'
2018-01-03 12:01:49,334:ERROR:flask_appbuilder.security.sqla.manager:Remove Permission from View Error: 'list' object has no attribute 'permission'
2018-01-03 12:01:49,632:ERROR:flask_appbuilder.security.sqla.manager:Remove Permission from View Error: 'list' object has no attribute 'permission'
2018-01-03 12:01:49,679:ERROR:flask_appbuilder.security.sqla.manager:Remove Permission from View Error: 'list' object has no attribute 'permission'
INFO  [alembic.runtime.migration] Context impl SQLiteImpl.
INFO  [alembic.runtime.migration] Will assume transactional DDL.
Traceback (most recent call last):
  File "/home/ubuntu/work/venv/bin/superset", line 15, in <module>
    manager.run()
  File "/home/ubuntu/work/venv/local/lib/python2.7/site-packages/flask_script/__init__.py", line 412, in run
    result = self.handle(sys.argv[0], sys.argv[1:])
  File "/home/ubuntu/work/venv/local/lib/python2.7/site-packages/flask_script/__init__.py", line 383, in handle
    res = handle(*args, **config)
  File "/home/ubuntu/work/venv/local/lib/python2.7/site-packages/flask_script/commands.py", line 216, in __call__
    return self.run(*args, **kwargs)
  File "/home/ubuntu/work/venv/local/lib/python2.7/site-packages/flask_migrate/__init__.py", line 244, in upgrade
    command.upgrade(config, revision, sql=sql, tag=tag)
  File "/home/ubuntu/work/venv/local/lib/python2.7/site-packages/alembic/command.py", line 254, in upgrade
    script.run_env()
  File "/home/ubuntu/work/venv/local/lib/python2.7/site-packages/alembic/script/base.py", line 425, in run_env
    util.load_python_file(self.dir, 'env.py')
  File "/home/ubuntu/work/venv/local/lib/python2.7/site-packages/alembic/util/pyfiles.py", line 81, in load_python_file
    module = load_module_py(module_id, path)
  File "/home/ubuntu/work/venv/local/lib/python2.7/site-packages/alembic/util/compat.py", line 141, in load_module_py
    mod = imp.load_source(module_id, path, fp)
  File "/home/ubuntu/work/venv/local/lib/python2.7/site-packages/superset/migrations/env.py", line 101, in <module>
    run_migrations_online()
  File "/home/ubuntu/work/venv/local/lib/python2.7/site-packages/superset/migrations/env.py", line 94, in run_migrations_online
    context.run_migrations()
  File "<string>", line 8, in run_migrations
  File "/home/ubuntu/work/venv/local/lib/python2.7/site-packages/alembic/runtime/environment.py", line 836, in run_migrations
    self.get_context().run_migrations(**kw)
  File "/home/ubuntu/work/venv/local/lib/python2.7/site-packages/alembic/runtime/migration.py", line 321, in run_migrations
    for step in self._migrations_fn(heads, self):
  File "/home/ubuntu/work/venv/local/lib/python2.7/site-packages/alembic/command.py", line 243, in upgrade
    return script._upgrade_revs(revision, rev)
  File "/home/ubuntu/work/venv/local/lib/python2.7/site-packages/alembic/script/base.py", line 338, in _upgrade_revs
    for script in reversed(list(revs))
  File "/usr/lib/python2.7/contextlib.py", line 35, in __exit__
    self.gen.throw(type, value, traceback)
  File "/home/ubuntu/work/venv/local/lib/python2.7/site-packages/alembic/script/base.py", line 174, in _catch_revision_errors
    compat.raise_from_cause(util.CommandError(resolution))
  File "/home/ubuntu/work/venv/local/lib/python2.7/site-packages/alembic/util/compat.py", line 205, in raise_from_cause
    reraise(type(exception), exception, tb=exc_tb)
  File "/home/ubuntu/work/venv/local/lib/python2.7/site-packages/alembic/script/base.py", line 143, in _catch_revision_errors
    yield
  File "/home/ubuntu/work/venv/local/lib/python2.7/site-packages/alembic/script/base.py", line 334, in _upgrade_revs
    revs = list(revs)
  File "/home/ubuntu/work/venv/local/lib/python2.7/site-packages/alembic/script/revision.py", line 645, in _iterate_revisions
    requested_lowers = self.get_revisions(lower)
  File "/home/ubuntu/work/venv/local/lib/python2.7/site-packages/alembic/script/revision.py", line 299, in get_revisions
    return sum([self.get_revisions(id_elem) for id_elem in id_], ())
  File "/home/ubuntu/work/venv/local/lib/python2.7/site-packages/alembic/script/revision.py", line 304, in get_revisions
    for rev_id in resolved_id)
  File "/home/ubuntu/work/venv/local/lib/python2.7/site-packages/alembic/script/revision.py", line 304, in <genexpr>
    for rev_id in resolved_id)
  File "/home/ubuntu/work/venv/local/lib/python2.7/site-packages/alembic/script/revision.py", line 362, in _revision_for_ident
    resolved_id)
alembic.util.exc.CommandError: Can't locate revision identified by '4736ec66ce19'

And then I upgraded to the latest version and run the migrations again. I still get OperationalError: (sqlite3.OperationalError) no such column: dbs.impersonate_user .

@xrmx @mistercrunch any thoughts on what I can try next?

BTW, I use the default superset DB superset.db: SQLite 3.x database.

@xrmx
Copy link
Contributor

xrmx commented Jan 3, 2018

Isn't it strange that superset db upgrade created a new db? Are you sure your superset instance is not using a different database?

@mistercrunch
Copy link
Member

Can't locate revision identified by '4736ec66ce19' seems to point in the direction that your DB is further in change history than the repo. You'd have to either downgrade while the migration that's stamped in the db exists in the release, or reset the db.

@stale
Copy link

stale bot commented Apr 11, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. For admin, please label this issue .pinned to prevent stale bot from closing the issue.

@stale stale bot added the inactive Inactive for >= 30 days label Apr 11, 2019
@stale stale bot closed this as completed Apr 18, 2019
@bivav
Copy link

bivav commented Jun 12, 2019

Can't locate revision identified by '4736ec66ce19' seems to point in the direction that your DB is further in change history than the repo. You'd have to either downgrade while the migration that's stamped in the db exists in the release, or reset the db.

Could you please tell me how we can reset the db?

ERROR [root] Error: Can't locate revision identified by afc69274c25a

is really giving me hard time. I just want to reset it.

@BigDataArtist
Copy link

Can't locate revision identified by '4736ec66ce19' seems to point in the direction that your DB is further in change history than the repo. You'd have to either downgrade while the migration that's stamped in the db exists in the release, or reset the db.

Could you please tell me how we can reset the db?

ERROR [root] Error: Can't locate revision identified by afc69274c25a

is really giving me hard time. I just want to reset it.

Were you able to fix it somehow ? I am facing the same issue @bivav

@bivav
Copy link

bivav commented Apr 15, 2020

Can't locate revision identified by '4736ec66ce19' seems to point in the direction that your DB is further in change history than the repo. You'd have to either downgrade while the migration that's stamped in the db exists in the release, or reset the db.

Could you please tell me how we can reset the db?
ERROR [root] Error: Can't locate revision identified by afc69274c25a
is really giving me hard time. I just want to reset it.

Were you able to fix it somehow ? I am facing the same issue @bivav

@BigDataArtist
Well I did find that superset db resides in /home/user/.superset/db

Now I am not working on superset but when I had error I just deleted that db and initialized the db from beginning.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
inactive Inactive for >= 30 days
Projects
None yet
Development

No branches or pull requests

5 participants