专栏首页有困难要上,没有困难创造困难也要上!Superset安装出错 sqlalchemy.exc.InvalidRequestError: Can't determine which FROM clause to join from, ...

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

问题描述

今天试着在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](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](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](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](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](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](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](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](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](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](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](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](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](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](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](base.py)", line 475, in run_env
 util.load_python_file(self.dir, "[env.py](env.py)")

 File "/home/jhadmin/.pyenv/versions/3.7.2/envs/myenv-3.7.2/lib/python3.7/site-packages/alembic/util/[pyfiles.py](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](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](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](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](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](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](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](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](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](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](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](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](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 条评论
登录 后参与评论

相关文章

  • Python3运行时查看线程信息

    kongxx
  • Windows上通过命令行参数限制CPU

    kongxx
  • 设置Docker允许非root用户操作

    以前写过一篇博客介绍过怎样允许非root用户来访问Docker,当时的方法是将用户加入的docker组里,这样做安全是安全了,但是实在是太麻烦了,对于我这种安全...

    kongxx
  • window下python3里pip安装

    最近在学Django时遇到了一个问题,python3.6版本下使用pip安装mysql-python失败。其实一句话很简单,python3以上使用的是pymys...

    py3study
  • 优化你的异常输出,只需一行代码!

    完整的输出信息如下图片所示,中间一道分割线,然后输出异常的堆栈,最后是精简的异常名称和提示。

    double
  • requests模块报错:Use body.encode('utf-8') if you want to send it encoded in UTF-8.

    在做 企业向微信用户个人付款  功能时,调用第三方sdk,在 进行 requests 的post请求时,

    用户1558882
  • ubuntu下的虚拟环境中安装Django的操作方法

    有些朋友对“mkvirtualenv 文件名” 有疑问,这个是默认为python2版本

    砸漏
  • python_目录结构

    目录组织方式 关于如何组织一个较好的Python工程目录结构,已经有一些得到了共识的目录结构。在Stackoverflow的这个问题上,能看到大家对Python...

    py3study
  • django 博客系统开发

    以谁为师
  • Django基本命令

    下载Django pip3 install django #默认下载最新版 pip3 install django==1.11.1...

    人生不如戏

扫码关注云+社区

领取腾讯云代金券