Error while running “superset db upgrade” after changing metadata DB to vertica

741 views
Skip to first unread message

rishi reddy

unread,
Mar 4, 2019, 4:42:47 PM3/4/19
to sqlalchemy-alembic

I am trying to change the metadata DB to Vertica from sqlite and I am facing an issue while running "superset db upgrade" as part of bringing up Superset application

Steps to reproduce:

1) Installed Superset using pip (pip install superset)

2) Created "superset_config.py" with below content:

#---------------------------------------------------------
# Superset specific config
#---------------------------------------------------------
ROW_LIMIT = 5000

SUPERSET_WEBSERVER_PORT = 8088
#---------------------------------------------------------

#---------------------------------------------------------
# Flask App Builder configuration
#---------------------------------------------------------
# Your App secret key
SECRET_KEY = '\2\1thisismyscretkey\1\2\e\y\y\h'

# The SQLAlchemy connection string to your database backend
# This connection defines the path to the database that stores your
# superset metadata (slices, connections, tables, dashboards, ...).
# Note that the connection information to connect to the datasources
# you want to explore are managed directly in the web UI
#SQLALCHEMY_DATABASE_URI = 'sqlite:////path/to/superset.db'
SQLALCHEMY_DATABASE_URI = 'vertica+vertica_python://dbadmin:pass...@x.x.x.x/vertica9'
# Flask-WTF flag for CSRF
WTF_CSRF_ENABLED = True
# Add endpoints that need to be exempt from CSRF protection
WTF_CSRF_EXEMPT_LIST = []
# A CSRF token that expires in 1 year
WTF_CSRF_TIME_LIMIT = 60 * 60 * 24 * 365

# Set this API key to enable Mapbox visualizations
MAPBOX_API_KEY = ''

3) Added superset_config.py path to PYTHONPATH

export PYTHONPATH=/usr/local/lib/python3.6/site-packages/superset/:/usr/local/bin/python3

4) Installed SqlAlchemy Vertica drivers. pip install sqlalchemy-vertica-python

5) Ran "fabmanager create-admin --app superset" which successfully created admin user in vertica

6) While running "superset db upgrade", I am seeing below error:

[root@user ~]# superset db upgrade
Loaded your LOCAL configuration at [/usr/local/lib/python3.6/site-packages/superset/superset_config.py]
Traceback (most recent call last):
  File "/usr/local/bin/superset", line 15, in <module>
    cli()
  File "/usr/local/lib/python3.6/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/flask/cli.py", line 557, in main
    return super(FlaskGroup, self).main(*args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.6/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.6/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.6/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.6/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/flask/cli.py", line 412, in decorator
    return __ctx.invoke(f, *args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/flask_migrate/cli.py", line 134, in upgrade
    _upgrade(directory, revision, sql, tag, x_arg)
  File "/usr/local/lib/python3.6/site-packages/flask_migrate/__init__.py", line 95, in wrapped
    f(*args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/flask_migrate/__init__.py", line 280, in upgrade
    command.upgrade(config, revision, sql=sql, tag=tag)
  File "/usr/local/lib/python3.6/site-packages/alembic/command.py", line 276, in upgrade
    script.run_env()
  File "/usr/local/lib/python3.6/site-packages/alembic/script/base.py", line 475, in run_env
    util.load_python_file(self.dir, "env.py")
  File "/usr/local/lib/python3.6/site-packages/alembic/util/pyfiles.py", line 90, in load_python_file
    module = load_module_py(module_id, path)
  File "/usr/local/lib/python3.6/site-packages/alembic/util/compat.py", line 156, in load_module_py
    spec.loader.exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 205, in _call_with_frames_removed
  File "/usr/local/lib/python3.6/site-packages/superset/migrations/env.py", line 100, in <module>
    run_migrations_online()
  File "/usr/local/lib/python3.6/site-packages/superset/migrations/env.py", line 89, in run_migrations_online
    **kwargs)
  File "<string>", line 8, in configure
  File "/usr/local/lib/python3.6/site-packages/alembic/runtime/environment.py", line 815, in configure
    opts=opts,
  File "/usr/local/lib/python3.6/site-packages/alembic/runtime/migration.py", line 190, in configure
    return MigrationContext(dialect, connection, opts, environment_context)
  File "/usr/local/lib/python3.6/site-packages/alembic/runtime/migration.py", line 122, in __init__
    self.impl = ddl.DefaultImpl.get_by_dialect(dialect)(
  File "/usr/local/lib/python3.6/site-packages/alembic/ddl/impl.py", line 71, in get_by_dialect
    return _impls[dialect.name]
KeyError: 'vertica'

I am stuck with this issue and able to move forward. Could anyone please help me and tell me whats wrong with it.

Thanks, 

Rishi

Mike Bayer

unread,
Mar 4, 2019, 5:00:01 PM3/4/19
to sqlalchem...@googlegroups.com
Hi there -

I'm not familiar with "Superset", nor does Alembic have built in
support for the "Vertica" database. It looks like the Vertica
SQLAlchemy drive doesn't have Alembic support implemented which at the
very least would be a small stub DefaultImpl subclass.. You would
need to consult with the developers of the Vertica SQLAlchemy driver
to get help with your application.
> --
> You received this message because you are subscribed to the Google Groups "sqlalchemy-alembic" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy-alem...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages