无效的 PostgreSQL 连接字符串在 Superset 中。

huangapple go评论159阅读模式
英文:

Invalid Connection string in postgresql with superset

问题

我在使用Superset连接PostgreSQL时遇到了问题,尽管我已经提供了连接的用户名、密码、主机名和数据库名称,而且我已经安装了PostgreSQL和psycopg2。

它显示错误信息:

错误: 连接失败!

错误信息弹出在Superset页面上。

错误信息如下:

  1. 错误: 连接失败!
  2. 返回的错误消息是:
  3. 没有找到名为 'psycopg2' 的模块。
  4. 堆栈跟踪:
  5. Traceback (most recent call last):
  6. File "/home/tutree/venv/lib/python3.6/site-packages/superset/views/core.py", line 1702, in testconn
  7. engine = database.get_sqla_engine(user_name=username)
  8. File "/home/tutree/venv/lib/python3.6/site-packages/superset/utils/core.py", line 131, in __call__
  9. value = self.func(*args, **kwargs)
  10. File "/home/tutree/venv/lib/python3.6/site-packages/superset/models/core.py", line 911, in get_sqla_engine
  11. return create_engine(url, **params)
  12. File "/home/tutree/venv/lib/python3.6/site-packages/sqlalchemy/engine/__init__.py", line 479, in create_engine
  13. return strategy.create(*args, **kwargs)
  14. File "/home/tutree/venv/lib/python3.6/site-packages/sqlalchemy/engine/strategies.py", line 87, in create
  15. dbapi = dialect_cls.dbapi(**dbapi_args)
  16. File "/home/tutree/venv/lib/python3.6/site-packages/sqlalchemy/dialects/postgresql/psycopg2.py", line 737, in dbapi
  17. import psycopg2
  18. ModuleNotFoundError: 没有找到名为 'psycopg2' 的模块。
英文:

I am facing problem to connect postgresql with superset while i giving my connection username,password hostname and database name
and when we click on test connection even I have install postgresql and psycopg2.

It says

> ERROR: {"error": "Connection failed!

The error and shows pop up in the superset page.

  1. ERROR: {"error": "Connection failed!
  2. The error message returned was:
  3. No module named 'psycopg2'", "stacktrace": "Traceback (most recent call last):
  4. File \"/home/tutree/venv/lib/python3.6/site-packages/superset/views/core.py\", line 1702, in testconn
  5. engine = database.get_sqla_engine(user_name=username)
  6. File \"/home/tutree/venv/lib/python3.6/site-packages/superset/utils/core.py\", line 131, in __call__
  7. value = self.func(*args, **kwargs)
  8. File \"/home/tutree/venv/lib/python3.6/site-packages/superset/models/core.py\", line 911, in get_sqla_engine
  9. return create_engine(url, **params)
  10. File \"/home/tutree/venv/lib/python3.6/site-packages/sqlalchemy/engine/__init__.py\", line 479, in create_engine
  11. return strategy.create(*args, **kwargs)
  12. File \"/home/tutree/venv/lib/python3.6/site-packages/sqlalchemy/engine/strategies.py\", line 87, in create
  13. dbapi = dialect_cls.dbapi(**dbapi_args)
  14. File \"/home/tutree/venv/lib/python3.6/site-packages/sqlalchemy/dialects/postgresql/psycopg2.py\", line 737, in dbapi
  15. import psycopg2
  16. ModuleNotFoundError: No module named 'psycopg2'
  17. "}

答案1

得分: 1

我通过运行以下命令来解决了这个问题:

  1. pip install psycopg2
英文:

I solved it by running this command

  1. pip install psycopg2

答案2

得分: 0

读取错误消息:

问题可能是您需要在与原始的 superset 相同的虚拟环境中安装 psychopg2。

所以:

  1. 1. 激活您的虚拟环境
  2. 2. 安装必要的依赖
  3. 3. 运行 superset
英文:

Read the error message:

The problem may be that you need to install psychopg2 on the same virtualenv as the original superset.

so:

  1. 1. source your-virtual-env
  2. 2. pip install the requriements
  3. 3. run superset

huangapple
  • 本文由 发表于 2020年1月6日 19:23:33
  • 转载请务必保留本文链接:https://go.coder-hub.com/59611246.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定