我想尝试一下板条箱。我首先尝试通过成功加载一些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)
答案 0 :(得分:0)
我还没有尝试过,但是根据documentation'localhost:4200'的假设,您可以仅使用engine = sa.create_engine('crate://')
进行连接