Superset安装出错 sqlalchemy.exc.InvalidRequestError: Can't determine which FROM clause to join from, the

BigData 专栏收录该内容
27 篇文章 0 订阅

问题描述

今天试着在python3.7.2上安装最新的superset(0.28.1),在初始化数据库的时候报如下错误:

$ superset db upgrade
...
Traceback (most recent call last):
  File "/home/jhadmin/.pyenv/versions/myenv-3.7.2/bin/superset", line 15, in <module>
    cli()
  File "/home/jhadmin/.pyenv/versions/3.7.2/envs/myenv-3.7.2/lib/python3.7/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/home/jhadmin/.pyenv/versions/3.7.2/envs/myenv-3.7.2/lib/python3.7/site-packages/flask/cli.py", line 380, in main
    return AppGroup.main(self, *args, **kwargs)
  File "/home/jhadmin/.pyenv/versions/3.7.2/envs/myenv-3.7.2/lib/python3.7/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/home/jhadmin/.pyenv/versions/3.7.2/envs/myenv-3.7.2/lib/python3.7/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/jhadmin/.pyenv/versions/3.7.2/envs/myenv-3.7.2/lib/python3.7/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/jhadmin/.pyenv/versions/3.7.2/envs/myenv-3.7.2/lib/python3.7/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/jhadmin/.pyenv/versions/3.7.2/envs/myenv-3.7.2/lib/python3.7/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/home/jhadmin/.pyenv/versions/3.7.2/envs/myenv-3.7.2/lib/python3.7/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/jhadmin/.pyenv/versions/3.7.2/envs/myenv-3.7.2/lib/python3.7/site-packages/flask/cli.py", line 257, in decorator
    return __ctx.invoke(f, *args, **kwargs)
  File "/home/jhadmin/.pyenv/versions/3.7.2/envs/myenv-3.7.2/lib/python3.7/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/home/jhadmin/.pyenv/versions/3.7.2/envs/myenv-3.7.2/lib/python3.7/site-packages/flask_migrate/cli.py", line 134, in upgrade
    _upgrade(directory, revision, sql, tag, x_arg)
  File "/home/jhadmin/.pyenv/versions/3.7.2/envs/myenv-3.7.2/lib/python3.7/site-packages/flask_migrate/__init__.py", line 95, in wrapped
    f(*args, **kwargs)
  File "/home/jhadmin/.pyenv/versions/3.7.2/envs/myenv-3.7.2/lib/python3.7/site-packages/flask_migrate/__init__.py", line 280, in upgrade
    command.upgrade(config, revision, sql=sql, tag=tag)
  File "/home/jhadmin/.pyenv/versions/3.7.2/envs/myenv-3.7.2/lib/python3.7/site-packages/alembic/command.py", line 276, in upgrade
    script.run_env()
  File "/home/jhadmin/.pyenv/versions/3.7.2/envs/myenv-3.7.2/lib/python3.7/site-packages/alembic/script/base.py", line 475, in run_env
    util.load_python_file(self.dir, "env.py")
  File "/home/jhadmin/.pyenv/versions/3.7.2/envs/myenv-3.7.2/lib/python3.7/site-packages/alembic/util/pyfiles.py", line 90, in load_python_file
    module = load_module_py(module_id, path)
  File "/home/jhadmin/.pyenv/versions/3.7.2/envs/myenv-3.7.2/lib/python3.7/site-packages/alembic/util/compat.py", line 156, 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/jhadmin/.pyenv/versions/3.7.2/envs/myenv-3.7.2/lib/python3.7/site-packages/superset/migrations/env.py", line 100, in <module>
    run_migrations_online()
  File "/home/jhadmin/.pyenv/versions/3.7.2/envs/myenv-3.7.2/lib/python3.7/site-packages/superset/migrations/env.py", line 93, in run_migrations_online
    context.run_migrations()
  File "<string>", line 8, in run_migrations
  File "/home/jhadmin/.pyenv/versions/3.7.2/envs/myenv-3.7.2/lib/python3.7/site-packages/alembic/runtime/environment.py", line 839, in run_migrations
    self.get_context().run_migrations(**kw)
  File "/home/jhadmin/.pyenv/versions/3.7.2/envs/myenv-3.7.2/lib/python3.7/site-packages/alembic/runtime/migration.py", line 361, in run_migrations
    step.migration_fn(**kw)
  File "/home/jhadmin/.pyenv/versions/3.7.2/envs/myenv-3.7.2/lib/python3.7/site-packages/superset/migrations/versions/4451805bbaa1_remove_double_percents.py", line 82, in upgrade
    replace('%%', '%')
  File "/home/jhadmin/.pyenv/versions/3.7.2/envs/myenv-3.7.2/lib/python3.7/site-packages/superset/migrations/versions/4451805bbaa1_remove_double_percents.py", line 53, in replace
    .join(Table)
  File "/home/jhadmin/.pyenv/versions/3.7.2/envs/myenv-3.7.2/lib/python3.7/site-packages/sqlalchemy/orm/query.py", line 2235, in join
    from_joinpoint=from_joinpoint,
  File "<string>", line 2, in _join
  File "/home/jhadmin/.pyenv/versions/3.7.2/envs/myenv-3.7.2/lib/python3.7/site-packages/sqlalchemy/orm/base.py", line 220, in generate
    fn(self, *args[1:], **kw)
  File "/home/jhadmin/.pyenv/versions/3.7.2/envs/myenv-3.7.2/lib/python3.7/site-packages/sqlalchemy/orm/query.py", line 2414, in _join
    left, right, onclause, prop, create_aliases, outerjoin, full
  File "/home/jhadmin/.pyenv/versions/3.7.2/envs/myenv-3.7.2/lib/python3.7/site-packages/sqlalchemy/orm/query.py", line 2437, in _join_left_to_right
    ) = self._join_determine_implicit_left_side(left, right, onclause)
  File "/home/jhadmin/.pyenv/versions/3.7.2/envs/myenv-3.7.2/lib/python3.7/site-packages/sqlalchemy/orm/query.py", line 2568, in _join_determine_implicit_left_side
    "Can't determine which FROM clause to join "
sqlalchemy.exc.InvalidRequestError: Can't determine which FROM clause to join from, there are multiple FROMS which can join to this entity. Try adding an explicit ON clause to help resolve the ambiguity.

问题原因

这是 SQLAlchemy 库版本太高导致的,需要安装低版本的 SQLAlchemy 库。

解决办法

# 查看当前 SQLAlchemy 版本
$ pip list | grep -i sqlalchemy
Flask-SQLAlchemy 2.3.2   
SQLAlchemy       1.3.2   
SQLAlchemy-Utils 0.33.11

# 安装低版本 SQLAlchemy
$ pip install SQLAlchemy==1.2.18

然后重新运行 “superset db upgrade” 命令初始化数据库。

  • 0
    点赞
  • 4
    评论
  • 0
    收藏
  • 一键三连
    一键三连
  • 扫一扫,分享海报

相关推荐
©️2020 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、C币套餐、付费专栏及课程。

余额充值