LakeQL
Overview
  • Package Map
query-builder
  • Filtering
  • Sorting & Paging
  • API Reference
config
  • Runtime Config
  • API Reference
trino-client
  • Client Setup
  • Executing Queries
  • Streaming
  • Metadata
  • API Reference
fabric-client
  • Client Setup
  • Executing Queries
  • API Reference
GitHub
LakeQL
  1. Packages
  2. fabric-client
  3. Executing Queries

On this page

  1. On-Behalf-Of
  2. Cancellation

Executing Queries

Run T-SQL statements and handle cancellation and on-behalf-of auth.

query executes a T-SQL statement and returns the result rows as keyed records.

1
2
3
4
const rows = await client.query<{ id: number; status: string }>({
  sql: "SELECT id, status FROM dbo.orders",
})

On-Behalf-Of #

Pass a bearerToken per query to run it as another identity (OBO flow). The client then uses a short-lived connection for that query instead of the shared pool:

1
2
await client.query({ sql: "SELECT 1", bearerToken: userAccessToken })

Cancellation #

Pass an AbortSignal to cancel an in-flight query:

1
2
3
4
const controller = new AbortController()
const promise = client.query({ sql: longRunningSql, signal: controller.signal })
controller.abort()

An aborted query throws a FabricCancellationError. A server-rejected statement throws a FabricQueryError. Connection and other client failures throw a FabricClientError.

Previous page

Client Setup

Next page

API Reference