Construct a TrinoClient with connection and authentication details to create a client.
1
2
3
4
5
6
7
8
9
import { TrinoClient } from "@lakeql/trino-client"
const client = new TrinoClient({
host: "http://localhost",
port: 8080,
catalog: "hive",
auth: { type: "basic", username: "user", password: "secret" },
})
Authentication #
The client supports two auth types:
1
2
3
4
5
6
// Basic auth
auth: { type: "basic", username: "user", password: "secret" }
// Bearer token
auth: { type: "bearer", token: "..." }
Optional Settings #
-
schema— a default schema, sent as theX-Trino-Schemaheader. -
source— a source identifier (X-Trino-Source); defaults to"nodejs". -
timeout— a default per-query timeout in milliseconds. -
retry— retry configuration (seeRetryConfig).
1
2
3
4
5
6
7
8
9
const client = new TrinoClient({
host: "http://localhost",
port: 8080,
catalog: "hive",
auth: { type: "basic", username: "user", password: "secret" },
timeout: 30_000,
retry: { maxRetries: 3 },
})