Query Firetiger with Javascript/Typescript
No official Javascript client exists for FlightSQL. We recommend npm package @firetiger-oss/flight-sql-client.
Install with a command like npm install @firetiger-oss/flight-sql-client.
Usage
Create a FlightSQL client:
import { FlightSQLClient } from "@firetiger-oss/flight-sql-client";
const client = new FlightSQLClient({
host: "query.<your firetiger deployment name>.firetigerapi.com",
port: 443,
plaintext: false, // true to disable TLS
username: "<find this on the Firetiger Integrations page>",
password: "<find this on the Firetiger Integrations page>",
});
Now execute a query:
const table = await client.executeQuery("SELECT count(*) AS n FROM logs");
The table object is an Arrow.dom.Table, which is a columnar data structure.
If you would rather work with rows, you can convert it with table.toArray():
const rows = table.toArray();
console.log(rows); // The output is something like [{ n: 12345 }]
Clean up:
await client.close();