Streaming
public async sql(
queryText: string,
options?: SqlQueryOptions,
onData?: (data: Table) => void
): Promise<Table>import { SpiceClient } from "@spiceai/spice";
const spiceClient = new SpiceClient(process.env.API_KEY);
const query = `
SELECT s_suppkey, s_name
FROM tpch.supplier
`;
const allSuppliers = await spiceClient.sql(query);
allSuppliers.toArray().forEach((row) => {
processSupplier(row.toJSON());
});Last updated
Was this helpful?