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. API Reference

On this page

  1. API Reference
    1. CFabricClient
      1. query
      2. close
    2. FwithRetry
    3. IRetryConfig
    4. VFABRIC_TOKEN_SCOPE
    5. FresolveCredential
    6. ITokenCredential
    7. CFabricClientError
    8. CFabricCancellationError
    9. CFabricQueryError
    10. CFabricTimeoutError
    11. TFabricAuth
    12. IFabricClientProps
    13. IQueryProps

API Reference

Complete reference for the @lakeql/fabric-client public API.

The complete public API of @lakeql/fabric-client, generated from the package's TypeScript source.

The entry point is the FabricClient class. It executes T-SQL queries against a Microsoft Fabric SQL endpoint. resolveCredential and the FabricAuth type handle authentication. withRetry wraps calls with configurable retry. The remaining exports are the configuration types and the error classes.

TDS client for Microsoft Fabric SQL endpoints.

Constructor

NameType
propsRequiredFabricClientProps

Connection and authentication configuration.

retryConfig?RetryConfig

Optional retry tuning applied to each query.

Default: {}

Properties

NameType
hostRequiredstring

Fabric SQL endpoint hostname.

portRequirednumber

Fabric SQL endpoint port.

catalogRequiredstring

Default catalog (database) for queries.

Methods

asyncquery

Executes a SQL statement and returns all result rows as keyed records.

Type Parameters
ParameterConstraintDefault
TRow—Record<string, unknown>
Parameters
NameType
propsRequiredQueryProps

Query text, optional signal, and optional bearer token.

Returns
Promise<TRow[]>

All rows produced by the query. *

asyncclose

Releases the underlying TDS connection pool.

Returns
Promise<void>

Executes an async function, retrying it on transient failures with exponential backoff.

Cancellations (FabricCancellationError and AbortError) are never retried. Non-transient errors are re-thrown immediately.

Type Parameters

ParameterConstraintDefault
T——

Parameters

NameType
fnRequired() => Promise<T>

The operation to execute; invoked once per attempt.

config?RetryConfig

Optional retry tuning; unset fields use the defaults.

Default: {}

Returns

Promise<T>

The value resolved by fn on the first successful attempt. *

Configuration for automatic retry behavior.

Properties

NameType
maxRetries?number

Maximum number of retry attempts (in addition to the initial call).

Default: 3
initialDelay?number

Initial delay between retries in milliseconds.

Default: 1000
maxDelay?number

Maximum delay between retries in milliseconds.

Default: 30000
backoffMultiplier?number

Multiplier applied to the delay after each attempt (exponential backoff).

Default: 2

Default OAuth2 scope for Azure SQL / Microsoft Fabric SQL endpoints.

Definition

"https://database.windows.net/.default"

Resolves a FabricAuth configuration into a TokenCredential.

Parameters

NameType
authRequiredFabricAuth

The authentication configuration from FabricClientProps.

Returns

TokenCredential

A token credential the client can use to authenticate the pool. *

A minimal token credential interface compatible with @azure/identity.

Only the TokenCredential.getToken method is required by the client.

Properties

NameType
getTokenRequired( scope: string ) => Promise<{ token: string; expiresOnTimestamp: number } | null>

Fetches an access token for the given scope.

Base error for Fabric client errors.

Constructor

NameType
messageRequiredstring

Human-readable error message.

statusCode?number

HTTP status code from the Fabric response.

Properties

NameType
statusCode?number

HTTP status code if available.

Error when a query is cancelled via AbortSignal.

Constructor

NameType
messageRequiredstring

Human-readable cancellation message.

Error during Fabric query execution (the server returned an error).

Constructor

NameType
messageRequiredstring

Human-readable error message from Fabric.

errorNumberRequirednumber

Numeric error number from the TDS response.

stateRequirednumber

SQL state code.

Properties

NameType
errorNumberRequirednumber

Fabric error number from the TDS response.

stateRequirednumber

SQL state code.

Error when a query exceeds its timeout.

Constructor

NameType
messageRequiredstring

Human-readable timeout error message.

Authentication credentials for a Fabric connection.

Definition

| {
      /** OAuth2 client credentials flow. */
      type: "oauth2"
      /** Azure AD tenant ID. */
      tenantId: string
      /** Azure AD application (client) ID. */
      clientId: string
      /** Azure AD client secret. */
      clientSecret: string
      /** Optional scope override. */
      scope?: string
    }
  | {
      /** Static bearer token. */
      type: "bearer"
      /** Bearer token value. */
      token: string
    }

Configuration for creating a FabricClient.

Properties

NameType
hostRequiredstring

Fabric SQL endpoint hostname.

portRequirednumber

Fabric SQL endpoint port.

catalogRequiredstring

Default catalog (database) for queries.

authRequiredFabricAuth

Authentication credentials.

source?string

Source identifier for diagnostics.

Properties for executing a SQL query.

Properties

NameType
sqlRequiredstring

SQL statement to execute.

signal?AbortSignal

Optional cancellation signal.

bearerToken?string

Optional bearer token for OBO (on-behalf-of) flow.

Previous page

Executing Queries