Skip to main content

Python SDK for Spice.ai

https://github.com/spiceai/spicepy

Install

pip install git+https://github.com/spiceai/spicepy@v2.0.0

Connect to spice runtime

from spicepy import Client

client = Client()

data = client.query(
'SELECT trip_distance, total_amount FROM taxi_trips ORDER BY trip_distance DESC LIMIT 10;',
timeout=5*60
)
pd = data.read_pandas()

Or pass custom flight address:

from spicepy import Client

client = Client(
flight_url="grpc://my_remote_spice_instance:50051"
)

data = client.query(
'SELECT trip_distance, total_amount FROM taxi_trips ORDER BY trip_distance DESC LIMIT 10;',
timeout=5*60
)
pd = data.read_pandas()