英文:
Invalid Connection string in postgresql with superset
问题
我在使用Superset连接PostgreSQL时遇到了问题,尽管我已经提供了连接的用户名、密码、主机名和数据库名称,而且我已经安装了PostgreSQL和psycopg2。
它显示错误信息:
错误: 连接失败!
错误信息弹出在Superset页面上。
错误信息如下:
错误: 连接失败!
返回的错误消息是:
没有找到名为 'psycopg2' 的模块。
堆栈跟踪:
Traceback (most recent call last):
File "/home/tutree/venv/lib/python3.6/site-packages/superset/views/core.py", line 1702, in testconn
engine = database.get_sqla_engine(user_name=username)
File "/home/tutree/venv/lib/python3.6/site-packages/superset/utils/core.py", line 131, in __call__
value = self.func(*args, **kwargs)
File "/home/tutree/venv/lib/python3.6/site-packages/superset/models/core.py", line 911, in get_sqla_engine
return create_engine(url, **params)
File "/home/tutree/venv/lib/python3.6/site-packages/sqlalchemy/engine/__init__.py", line 479, in create_engine
return strategy.create(*args, **kwargs)
File "/home/tutree/venv/lib/python3.6/site-packages/sqlalchemy/engine/strategies.py", line 87, in create
dbapi = dialect_cls.dbapi(**dbapi_args)
File "/home/tutree/venv/lib/python3.6/site-packages/sqlalchemy/dialects/postgresql/psycopg2.py", line 737, in dbapi
import psycopg2
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.
ERROR: {"error": "Connection failed!
The error message returned was:
No module named 'psycopg2'", "stacktrace": "Traceback (most recent call last):
File \"/home/tutree/venv/lib/python3.6/site-packages/superset/views/core.py\", line 1702, in testconn
engine = database.get_sqla_engine(user_name=username)
File \"/home/tutree/venv/lib/python3.6/site-packages/superset/utils/core.py\", line 131, in __call__
value = self.func(*args, **kwargs)
File \"/home/tutree/venv/lib/python3.6/site-packages/superset/models/core.py\", line 911, in get_sqla_engine
return create_engine(url, **params)
File \"/home/tutree/venv/lib/python3.6/site-packages/sqlalchemy/engine/__init__.py\", line 479, in create_engine
return strategy.create(*args, **kwargs)
File \"/home/tutree/venv/lib/python3.6/site-packages/sqlalchemy/engine/strategies.py\", line 87, in create
dbapi = dialect_cls.dbapi(**dbapi_args)
File \"/home/tutree/venv/lib/python3.6/site-packages/sqlalchemy/dialects/postgresql/psycopg2.py\", line 737, in dbapi
import psycopg2
ModuleNotFoundError: No module named 'psycopg2'
"}
答案1
得分: 1
我通过运行以下命令来解决了这个问题:
pip install psycopg2
英文:
I solved it by running this command
pip install psycopg2
答案2
得分: 0
读取错误消息:
问题可能是您需要在与原始的 superset 相同的虚拟环境中安装 psychopg2。
所以:
1. 激活您的虚拟环境
2. 安装必要的依赖
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. source your-virtual-env
2. pip install the requriements
3. run superset
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论