import { ConnectionOptions } from '@databricks/sql/dist/contracts/IDBSQLClient'; import { TTypeId as DatabricksDataTypes } from '@databricks/sql/thrift/TCLIService_types'; import { AnyType, CreateDatabricksCredentials, Metric, SupportedDbtAdapter, TimeIntervalUnit, UnnestSql, UnnestSqlArgs, WarehouseResults, WarehouseTypes, type ResultNumericKind, type TimestampDomain } from '@lightdash/common'; import { WarehouseCatalog } from '../types'; import WarehouseBaseClient from './WarehouseBaseClient'; import WarehouseBaseSqlBuilder from './WarehouseBaseSqlBuilder'; /** * Pre-registered Databricks public OAuth client ID for U2M authentication. * This is a built-in client that doesn't require registering a custom OAuth app. * This client id only works on the CLI redirect URIs. For the UI we require a custom OAuth app * with a valid whitelisted redirect URI. * https://docs.databricks.com/en/dev-tools/auth/oauth-u2m.html */ export declare const DATABRICKS_DEFAULT_OAUTH_CLIENT_ID = "databricks-cli"; export declare const isDatabricksCliOAuthClientId: (clientId: string | undefined) => boolean; export declare const getDatabricksNumericKind: (entry: { type: DatabricksDataTypes; typeQualifiers?: { qualifiers: Record; }; }) => ResultNumericKind | null; export declare const getDatabricksTimestampDomain: (type: string) => TimestampDomain | undefined; export declare class DatabricksSqlBuilder extends WarehouseBaseSqlBuilder { readonly type = WarehouseTypes.DATABRICKS; getAdapterType(): SupportedDbtAdapter; getMetricSql(sql: string, metric: Metric): string; getFieldQuoteChar(): string; escapeString(value: string): string; getIntervalSql(value: number, unit: TimeIntervalUnit): string; getTimestampDiffSeconds(startTimestampSql: string, endTimestampSql: string): string; getMedianSql(valueSql: string): string; buildArray(elements: string[]): string; buildArrayAgg(expression: string, orderBy?: string): string; getUnnestSql(args: UnnestSqlArgs): UnnestSql; } /** * The error conditions this client branches on, named exactly as in the * Databricks catalogue (https://docs.databricks.com/error-messages/error-conditions). * Only the ones we handle are listed; add here before matching a new one. */ export declare enum DatabricksErrorCondition { /** SQLSTATE 42P01 */ TableOrViewNotFound = "TABLE_OR_VIEW_NOT_FOUND", /** SQLSTATE 42601. What a runtime without `DESCRIBE ... AS JSON` answers. */ ParseSyntaxError = "PARSE_SYNTAX_ERROR" } export declare const getDatabricksErrorCondition: (error: unknown) => DatabricksErrorCondition | undefined; export declare class DatabricksWarehouseClient extends WarehouseBaseClient { schema: string; catalog?: string; connectionOptions: ConnectionOptions; private readonly enableTimeouts; constructor(credentials: CreateDatabricksCredentials); private openSession; private streamQueryOnSession; streamQuery(sql: string, streamCallback: (data: WarehouseResults) => void | Promise, options: { values?: AnyType[]; tags?: Record; timezone?: string; }): Promise; private static fetchAllRows; private static getTableColumns; getCatalog(requests: { database: string; schema: string; table: string; }[]): Promise; getAllTables(): Promise<{ database: any; schema: any; table: any; tableType: import("@lightdash/common").WarehouseTableType; }[]>; getFields(tableName: string, schema?: string, database?: string, tags?: Record): Promise; } /** * Exchange Databricks OAuth M2M credentials for access and refresh tokens */ export declare const exchangeDatabricksOAuthCredentials: (host: string, clientId: string, clientSecret: string) => Promise<{ accessToken: string; refreshToken?: string; }>; /** * Refresh Databricks OAuth U2M access token using refresh token */ export declare const refreshDatabricksOAuthToken: (host: string, clientId: string, refreshToken: string, clientSecret?: string) => Promise<{ accessToken: string; refreshToken: string; expiresIn: number; }>; //# sourceMappingURL=DatabricksWarehouseClient.d.ts.map