Construct a FabricClient with the endpoint, catalog, and authentication to create a client.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import { FabricClient } from "@lakeql/fabric-client"
const client = new FabricClient({
host: "your-endpoint.datawarehouse.fabric.microsoft.com",
port: 1433,
catalog: "my_warehouse",
auth: {
type: "oauth2",
tenantId: "...",
clientId: "...",
clientSecret: "...",
},
})
Authentication #
The client supports two auth types. Both resolve to an Azure AD access token:
1
2
3
4
5
6
// OAuth2 client credentials
auth: { type: "oauth2", tenantId: "...", clientId: "...", clientSecret: "..." }
// Static bearer token
auth: { type: "bearer", token: "..." }
The oauth2 form accepts an optional scope field, but it currently has no effect. The token is always acquired for the Fabric SQL scope (https://database.windows.net/.default).
Retry #
The constructor takes an optional second argument, a RetryConfig. It applies to each query:
1
2
const client = new FabricClient(props, { maxRetries: 3 })
Connection Lifecycle #
The client manages a TDS connection pool internally. When you are done, call close to release it:
1
2
await client.close()
A closed client throws FabricClientError if used again.