将元数据数据库更改为vertica后,运行“ superset db upgrade”时出错

时间:2019-03-04 19:12:07

标签: sqlalchemy alembic superset apache-superset sqlalchemy-migrate

我是Superset的新手,正在尝试将其与我的应用程序集成。我正在尝试将元数据数据库从sqlite更改为Vertica,并且在运行“ superset db upgrade”作为启动Superset应用程序的一部分时遇到一个问题

复制步骤:

1)使用pip安装了超级集(pip安装超级集)

2)创建具有以下内容的“ superset_config.py”:

#---------------------------------------------------------
# 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:password@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)向PYTHONPATH添加了superset_config.py路径

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

4)已安装SqlAlchemy Vertica驱动程序。       pip安装sqlalchemy-vertica-python

5)运行“ fabmanager create-admin --app超集”,该操作成功在vertica中创建了admin用户

6)在运行“ superset db upgrade”时,我看到以下错误:

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

我对这个问题感到困惑,并且能够继续前进。谁能帮助我,告诉我这是怎么回事。

谢谢, 里士

0 个答案:

没有答案