import { AnyType, CreateSnowflakeCredentials, DimensionType, Metric, SupportedDbtAdapter, WarehouseQueryError, WarehouseResults, WarehouseTypes, type ResultNumericKind, type TimestampDomain, type WarehouseExecuteAsyncQuery, type WarehouseExecuteAsyncQueryArgs } from '@lightdash/common'; import { Connection, ConnectionOptions, SnowflakeError } from 'snowflake-sdk'; import { WarehouseCatalog } from '../types'; import WarehouseBaseClient from './WarehouseBaseClient'; import WarehouseBaseSqlBuilder from './WarehouseBaseSqlBuilder'; export declare enum SnowflakeTypes { NUMBER = "NUMBER", DECIMAL = "DECIMAL", NUMERIC = "NUMERIC", INTEGER = "INTEGER", INT = "INT", BIGINT = "BIGINT", SMALLINT = "SMALLINT", FLOAT = "FLOAT", FLOAT4 = "FLOAT4", FLOAT8 = "FLOAT8", DOUBLE = "DOUBLE", DOUBLE_PRECISION = "DOUBLE PRECISION", REAL = "REAL", FIXED = "FIXED", STRING = "STRING", TEXT = "TEXT", BOOLEAN = "BOOLEAN", DATE = "DATE", DATETIME = "DATETIME", TIME = "TIME", TIMESTAMP = "TIMESTAMP", TIMESTAMP_LTZ = "TIMESTAMP_LTZ", TIMESTAMP_NTZ = "TIMESTAMP_NTZ", TIMESTAMP_TZ = "TIMESTAMP_TZ", VARIANT = "VARIANT", OBJECT = "OBJECT", ARRAY = "ARRAY", GEOGRAPHY = "GEOGRAPHY" } export declare const getSnowflakeTimestampDomain: (type: string) => TimestampDomain | undefined; export type SnowflakeOAuthTokens = { accessToken: string; refreshToken: string; expiresAt: Date | null; }; export type SnowflakeSessionDefaults = { role: string | null; warehouse: string | null; database: string | null; schema: string | null; }; export type SnowflakeSessionInventory = { databases: { name: string; comment: string | null; kind: string | null; sizeBytes: number | null; }[]; warehouses: { name: string; size: string | null; state: string | null; autoSuspendSeconds: number | null; }[]; roles: { name: string; isDefault: boolean; }[]; schemas: { databaseName: string; name: string; }[]; }; export type SnowflakeSessionDiscovery = { user: string; defaults: SnowflakeSessionDefaults; inventory: SnowflakeSessionInventory; }; export type SnowflakeDiagnosticErrorCategory = 'account_identifier' | 'authentication' | 'private_key' | 'database_access' | 'warehouse_access' | 'network_policy' | 'unknown'; export type SnowflakeDiagnosticErrorDetails = { category: SnowflakeDiagnosticErrorCategory; code: string | null; sanitizedMessage: string; }; export declare const snowflakeIdentifier: (value: string) => string; export declare const mapSnowflakeDiagnosticError: (error: unknown) => SnowflakeDiagnosticErrorDetails; export declare class SnowflakeDiagnosticError extends Error { readonly details: SnowflakeDiagnosticErrorDetails; private readonly rawError; constructor(error: unknown); getRawError(): unknown; } export type SnowflakeDiagnosticSession = { connection: Connection; }; export type SnowflakePublicKeySlot = 'RSA_PUBLIC_KEY' | 'RSA_PUBLIC_KEY_2'; export type SnowflakePublicKeySlots = { RSA_PUBLIC_KEY: string | null; RSA_PUBLIC_KEY_2: string | null; }; /** NUMBER is FIXED with a scale at the source; scale 0 is an integer. */ export declare const getSnowflakeNumericKind: (type: string, scale: number | undefined) => ResultNumericKind | null; export declare const mapFieldType: (type: string) => DimensionType; export declare class SnowflakeSqlBuilder extends WarehouseBaseSqlBuilder { readonly type = WarehouseTypes.SNOWFLAKE; getAdapterType(): SupportedDbtAdapter; getMetricSql(sql: string, metric: Metric): string; escapeString(value: string): string; getTimestampDiffSeconds(startTimestampSql: string, endTimestampSql: string): string; buildArray(elements: string[]): string; buildArrayAgg(expression: string, orderBy?: string): string; } export declare class SnowflakeWarehouseClient extends WarehouseBaseClient { private static readonly MAX_QUERY_TAG_LENGTH; connectionOptions: ConnectionOptions; quotedIdentifiersIgnoreCase?: boolean; static formatQueryTag(tags: Record): string; private interactiveConnectionPromise?; private readonly privateKey; private readonly privateKeyPassphrase; private readonly oauthCredentialManager?; constructor(credentials: CreateSnowflakeCredentials); private getConnection; private isInteractiveAuthenticator; private getConnectionOptions; private createInteractiveConnection; private createConnection; openDiagnosticConnection(): Promise; selectOneDiagnosticConnection(session: SnowflakeDiagnosticSession): Promise; closeDiagnosticConnection(session: SnowflakeDiagnosticSession): Promise; getSessionDiscovery(user?: string): Promise; getUserPublicKeySlots(user: string): Promise; setUserPublicKey(user: string, slot: SnowflakePublicKeySlot, publicKey: string): Promise; unsetUserPublicKey(user: string, slot: SnowflakePublicKeySlot): Promise; getOAuthTokens(): SnowflakeOAuthTokens | null; createProgrammaticAccessToken(tokenName?: string, daysToExpiry?: number, minsToBypassNetworkPolicy?: number, roleRestriction?: string | null): Promise<{ tokenSecret: string; tokenName: string; }>; private prepareWarehouse; private getFieldsFromStatement; private destroyConnection; executeAsyncQuery({ sql, values, tags, timezone }: WarehouseExecuteAsyncQueryArgs, resultsStreamCallback?: (rows: WarehouseResults['rows'], fields: WarehouseResults['fields']) => void | Promise): Promise; private executeAsyncStatement; streamQuery(sql: string, streamCallback: (data: WarehouseResults) => void | Promise, options: { values?: AnyType[]; tags?: Record; timezone?: string; }): Promise; private executeStreamStatement; private executeStatements; private runTableCatalogQuery; getCatalog(config: { 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; private formatCustomErrorMessage; private formatWarehouseErrorMessage; parseError(error: SnowflakeError, query?: string): WarehouseQueryError; } //# sourceMappingURL=SnowflakeWarehouseClient.d.ts.map