我想用板条箱试一下。我第一次尝试它是通过从管理UI加载一些twitter数据和查询成功的。但是,当我尝试使用SQLAlchemy进行查询时,我得到了以下错误。
OperationalError: (crate.client.exceptions.ConnectionError)
No more Servers available, exception from last server: HTTPConnectionPool(host='localhost', port=4200):
Max retries exceeded with url:
/_sql (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f51485b2c18>:
Failed to establish a new connection: [Errno 111] Connection refused'))
[SQL: SELECT * FROM tweets LIMIT 100; ]
(Background on this error at: http://sqlalche.me/e/e3q8)
这是我运行的导致错误的代码。
from crate import client
import sqlalchemy as sa
import pandas as pd
engine = sa.create_engine('crate://localhost:4200')
query = (
"SELECT * "
"FROM tweets "
"LIMIT 100; "
)
df = pd.read_sql(query, engine)
有没有办法解决这个问题(设置都是默认的)?
更新:
Crate在主机系统上运行,而Jupyter在同一台计算机上的容器中运行。我可以通过主机上的"http://localhost:4200“访问机箱,但不能在同一网络中的其他机器上执行"http://xxx.xxx.xxx.xxx:4200”。
我都试过了:
engine = sa.create_engine('crate://10.7.116.222:4200')
engine = sa.create_engine('crate://')
导致了同样的错误:
Removed server http://127.0.0.1:4200 from active pool
Removed server http://127.0.0.1:4200 from active pool
OperationalError: (crate.client.exceptions.ConnectionError)
No more Servers available, exception from last server:
HTTPConnectionPool(host='127.0.0.1', port=4200):
Max retries exceeded with url:
/_sql (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f5147faaa58>:
Failed to establish a new connection: [Errno 111] Connection refused'))
[SQL: SELECT * FROM tweets LIMIT 10; ]
(Background on this error at: http://sqlalche.me/e/e3q8)
发布于 2019-06-24 08:43:21
我还没有尝试过,但是根据documentation,假设使用'localhost:4200‘,这样你就可以只使用engine = sa.create_engine('crate://')
连接了
https://stackoverflow.com/questions/56682441
复制相似问题