/** * @copyright Cube Dev, Inc. * @license Apache-2.0 * @fileoverview The `AthenaDriver` and related types declaration. */ import { MaybeCancelablePromise } from '@cubejs-backend/shared'; import { ColumnInfo } from '@aws-sdk/client-athena'; import { BaseDriver, DatabaseStructure, DownloadTableCSVData, DriverInterface, QueryOptions, UnloadOptions, StreamOptions, TableStructure, DriverCapabilities, DownloadTableMemoryData, StreamTableDataWithTypes, DownloadQueryResultsResult, DownloadQueryResultsOptions } from '@cubejs-backend/base-driver'; import { AthenaClientConfig } from '@aws-sdk/client-athena/dist-types/AthenaClient'; interface AthenaDriverOptions extends AthenaClientConfig { readOnly?: boolean; accessKeyId?: string; secretAccessKey?: string; workGroup?: string; catalog?: string; schema?: string; database?: string; S3OutputLocation?: string; exportBucket?: string; pollTimeout?: number; pollMaxInterval?: number; athenaAwsAssumeRoleArn?: string; athenaAwsAssumeRoleExternalId?: string; /** * The export bucket CSV file escape symbol. */ exportBucketCsvEscapeSymbol?: string; } export interface AthenaQueryId { QueryExecutionId: string; } export declare function applyParams(query: string, params: unknown[]): string; interface AthenaTable { schema: string; name: string; } export declare class AthenaDriver extends BaseDriver implements DriverInterface { /** * Returns default concurrency value. */ static getDefaultConcurrency(): number; private config; private athena; private schema; /** * Class constructor. */ constructor(config?: AthenaDriverOptions & { /** * Data source name. */ dataSource?: string; /** * Whether this driver is used for pre-aggregations. */ preAggregations?: boolean; /** * Max pool size value for the [cube]<-->[db] pool. */ maxPoolSize?: number; /** * Time to wait for a response from a connection after validation * request before determining it as not valid. Default - 10000 ms. */ testConnectionTimeout?: number; }); /** * Driver read-only flag. */ readOnly(): boolean; /** * Returns driver's capabilities object. */ capabilities(): DriverCapabilities; /** * Test driver's connection. */ testConnection(): Promise; /** * Executes a query and returns either query result memory data or * query result stream, depending on options. * Returns a cancelable promise that will stop the Athena query on cancel. */ downloadQueryResults(query: string, values: unknown[], options: DownloadQueryResultsOptions): MaybeCancelablePromise; /** * Executes query and returns table memory data that includes rows * and queried fields types. * Returns a cancelable promise that will stop the Athena query on cancel. */ memory(query: string, values: unknown[]): MaybeCancelablePromise; /** * Returns stream table object that includes query result stream and * queried fields types. * Returns a cancelable promise that will stop the Athena query on cancel. */ stream(query: string, values: unknown[], options: StreamOptions): MaybeCancelablePromise; /** * Executes query and returns queried rows. * Returns a cancelable promise that will stop the Athena query on cancel. */ query(query: string, values: unknown[], _options?: QueryOptions): MaybeCancelablePromise; /** * Executes query and returns async generator that yields queried * rows. */ protected lazyRowIterator(qid: AthenaQueryId, query: string, withTypes?: boolean): AsyncGenerator; /** * Save pre-aggregation data into a temp table. * Returns a cancelable promise that will stop the Athena query on cancel. */ loadPreAggregationIntoTable(preAggregationTableName: string, loadSql: string, params: any): MaybeCancelablePromise; /** * Determines whether export bucket feature is configured or not. */ isUnloadSupported(): Promise; /** * Returns to the Cubestore an object with links to unloaded to the * export bucket data. */ unload(tableName: string, options: UnloadOptions): Promise; /** * Unload data from a SQL query to an export bucket. */ private unloadWithSql; /** * Unload data from a temp table to an export bucket. */ private unloadWithTable; /** * Returns an array of queried fields meta info. */ queryColumnTypes(sql: string, params?: unknown[]): Promise; /** * Converts Athena to generic types and returns an array of queried * fields meta info. */ mapTypes(fields: ColumnInfo[]): TableStructure; /** * Returns an array of signed URLs of the unloaded csv files. */ private getCsvFiles; informationSchemaQuery(): string; tablesSchema(): Promise; protected startQuery(query: string, values: unknown[]): Promise; protected checkStatus(qid: AthenaQueryId): Promise; protected waitForSuccess(qid: AthenaQueryId, isCancelled?: () => boolean): Promise; protected stopQuery(qid: AthenaQueryId): Promise; protected viewsSchema(tablesSchema: DatabaseStructure): Promise; protected getAllTables(): Promise; protected getColumns(table: AthenaTable): Promise; protected mergeSchemas(arrSchemas: DatabaseStructure[]): DatabaseStructure; static normalizeS3Path(path: string): string; static splitS3Path(path: string): { bucket: string; prefix: string; }; } export {}; //# sourceMappingURL=AthenaDriver.d.ts.map