我想用板条箱试一试。我首先通过加载一些 twitter 数据并成功从管理 UI 进行查询来尝试它。但是,当我尝试使用 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 ”访问 Crate,但不能从同一 natwork 中的其他机器执行“ 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)