API Reference
SpiceClient(params)
The top-level object that connects to Spice.ai
params.api_key
(string, optional): API key to authenticate with the endpointparams.http_url
(string, optional):params.flight_url
(string, optional): URL of the endpoint to use (default:localhost:50051
, using local spice runtime)
Default connection to local spice runtime:
Connect to spice.ai api:
Or using shorthand:
SpiceClient Methods
query(queryText: string, onData: (partialData: Table) => void) => Table
queryText
: (string, required): The SQL query to executeonData
: (callback, optional): The callback function that is used for handling streaming data.
query
returns an Apache Arrow Table.
To get the data in JSON format, iterate over each row by calling toArray()
on the table and call toJSON()
on each row.
Get all of the elements for a column by calling getChild(name: string)
and then calling toJSON()
on the result.
Last updated