0

I'd like to give it a try with crate. I first tried it by loading some twitter data and query from admin UI successfully. However, when I tried to make a query with SQLAlchemy, I've got the following error.

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)

This is the code I ran that caused the error.

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)

Any idea how to fix it (the settings are all default)?


Update:

Crate is running on host system while Jupyter is running in a container on the same machine. I can access Crate via "http://localhost:4200" on the host machine but can't do "http://xxx.xxx.xxx.xxx:4200" from other machine in the same natwork.

I tried both:

engine = sa.create_engine('crate://10.7.116.222:4200')
engine = sa.create_engine('crate://')

which caused the same error:

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) 
bensw
  • 2,818
  • 5
  • 21
  • 31

1 Answers1

0

I haven't tried it but according to the documentation 'localhost:4200' is assumed so you could connect using just engine = sa.create_engine('crate://')

metase
  • 1,169
  • 2
  • 16
  • 29