from pyarrow import flight
query = 'SELECT * FROM eth.recent_blocks LIMIT 10;'
# Connect to the endpoint
client = flight.connect(f'grpc+tls://flight.spiceai.io')
# Authenticate with your app's API key
token_pair = client.authenticate_basic_token('', apiKey)
options = flight.FlightCallOptions(headers=[token_pair])
# Query and fetch a reader for the results
flight_info = client.get_flight_info(flight.FlightDescriptor.for_command(query), options)
reader = client.do_get(flight_info.endpoints[0].ticket, options)
# Convert to a Pandas DataFrame and print the results
print(reader.read_pandas())