- Connections over HTTP or HTTPS
- Supports HTTP Basic Authentication
- Per-query user information for access control
- Node 12 or newer.
- Trino 0.16x or newer.
npm install trino-client
or yarn add trino-client
For additional info on all available methods and types have a look at the API
docs here.
const trino: Trino = Trino.create({
server: 'http://localhost:8080',
catalog: 'tpcds',
schema: 'sf100000',
auth: new BasicAuth('test'),
});
const iter: Iterator<QueryResult> = await trino.query(
'select * from customer limit 100'
);
for await (const queryResult of iter) {
console.log(queryResult.data);
}
const data: QueryData[] = await iter
.map(r => r.data ?? [])
.fold<QueryData[]>([], (row, acc) => [...acc, ...row]);
More usage examples can be found in the integration tests.
Filipe Regadas (regadas) 2022