Streaming
public async sql(
queryText: string,
optionsOrCallback?: SqlQueryOptions | ((data: Table) => void),
onData?: (data: Table) => void,
headers?: { [key: string]: string }
): Promise<Table>import { SpiceClient } from "@spiceai/spice";
const spiceClient = new SpiceClient({ apiKey: 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);
});Last updated
Was this helpful?