Skip to main content

JavaScript SDK for Spice.ai

https://github.com/spiceai/spice.js

Install

npm i @spiceai/spice

Connect to spice runtime

Create a SpiceClient using default configuration:

import { SpiceClient } from '@spiceai/spice';

const main = async () => {
const spiceClient = new SpiceClient();

const table = await spiceClient.query(
'SELECT trip_distance, total_amount FROM taxi_trips ORDER BY trip_distance DESC LIMIT 10;'
);

console.table(table.toArray());
};

main();

Or pass custom flight address:

const spiceClient = new SpiceClient({
flight_url: 'my_remote_spice_instance:50051'
});