@lightdash/warehouses 2.430.0 → 2.431.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.tsbuildinfo.build +1 -1
- package/dist/warehouseClientFromCredentials.d.ts +2 -1
- package/dist/warehouseClientFromCredentials.d.ts.map +1 -1
- package/dist/warehouseClientFromCredentials.js +1 -1
- package/dist/warehouseClients/AthenaWarehouseClient.d.ts +7 -1
- package/dist/warehouseClients/AthenaWarehouseClient.d.ts.map +1 -1
- package/dist/warehouseClients/AthenaWarehouseClient.js +14 -3
- package/package.json +2 -2
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { CreateWarehouseCredentials } from '@lightdash/common';
|
|
2
2
|
import { WarehouseClient } from './types';
|
|
3
|
+
import { type AthenaWarehouseClientOptions } from './warehouseClients/AthenaWarehouseClient';
|
|
3
4
|
import { type ClickhouseWarehouseClientOptions } from './warehouseClients/ClickhouseWarehouseClient';
|
|
4
5
|
import { type DuckdbWarehouseClientOptions } from './warehouseClients/DuckdbWarehouseClient';
|
|
5
|
-
export type WarehouseClientOptions = DuckdbWarehouseClientOptions & ClickhouseWarehouseClientOptions;
|
|
6
|
+
export type WarehouseClientOptions = DuckdbWarehouseClientOptions & ClickhouseWarehouseClientOptions & AthenaWarehouseClientOptions;
|
|
6
7
|
export declare const warehouseClientFromCredentials: (credentials: CreateWarehouseCredentials, options?: WarehouseClientOptions) => WarehouseClient;
|
|
7
8
|
//# sourceMappingURL=warehouseClientFromCredentials.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"warehouseClientFromCredentials.d.ts","sourceRoot":"","sources":["../src/warehouseClientFromCredentials.ts"],"names":[],"mappings":"AAAA,OAAO,EAEH,0BAA0B,EAG7B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"warehouseClientFromCredentials.d.ts","sourceRoot":"","sources":["../src/warehouseClientFromCredentials.ts"],"names":[],"mappings":"AAAA,OAAO,EAEH,0BAA0B,EAG7B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,EAEH,KAAK,4BAA4B,EACpC,MAAM,0CAA0C,CAAC;AAElD,OAAO,EAEH,KAAK,gCAAgC,EACxC,MAAM,8CAA8C,CAAC;AAEtD,OAAO,EAEH,KAAK,4BAA4B,EACpC,MAAM,0CAA0C,CAAC;AAMlD,MAAM,MAAM,sBAAsB,GAAG,4BAA4B,GAC7D,gCAAgC,GAChC,4BAA4B,CAAC;AAEjC,eAAO,MAAM,8BAA8B,gBAC1B,0BAA0B,YAC7B,sBAAsB,KACjC,eA4BF,CAAC"}
|
|
@@ -28,7 +28,7 @@ const warehouseClientFromCredentials = (credentials, options) => {
|
|
|
28
28
|
case common_1.WarehouseTypes.CLICKHOUSE:
|
|
29
29
|
return new ClickhouseWarehouseClient_1.ClickhouseWarehouseClient(credentials, options);
|
|
30
30
|
case common_1.WarehouseTypes.ATHENA:
|
|
31
|
-
return new AthenaWarehouseClient_1.AthenaWarehouseClient(credentials);
|
|
31
|
+
return new AthenaWarehouseClient_1.AthenaWarehouseClient(credentials, options);
|
|
32
32
|
case common_1.WarehouseTypes.DUCKDB:
|
|
33
33
|
return new DuckdbWarehouseClient_1.DuckdbWarehouseClient(credentials, options);
|
|
34
34
|
default:
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { AthenaClient } from '@aws-sdk/client-athena';
|
|
2
|
+
import { fromTemporaryCredentials } from '@aws-sdk/credential-providers';
|
|
2
3
|
import { CreateAthenaCredentials, DimensionType, Metric, SupportedDbtAdapter, TimeIntervalUnit, WarehouseDatabaseListing, WarehouseListedDatabase, WarehouseResults, WarehouseTables, WarehouseTypes, type ResultNumericKind, type TimestampDomain } from '@lightdash/common';
|
|
3
4
|
import { WarehouseCatalog } from '../types';
|
|
4
5
|
import WarehouseBaseClient from './WarehouseBaseClient';
|
|
@@ -43,9 +44,13 @@ export declare class AthenaSqlBuilder extends WarehouseBaseSqlBuilder {
|
|
|
43
44
|
getTimestampDiffSeconds(startTimestampSql: string, endTimestampSql: string): string;
|
|
44
45
|
getMedianSql(valueSql: string): string;
|
|
45
46
|
}
|
|
47
|
+
type AwsCredentialProvider = ReturnType<typeof fromTemporaryCredentials>;
|
|
48
|
+
export type AthenaWarehouseClientOptions = {
|
|
49
|
+
awsCredentials?: AwsCredentialProvider;
|
|
50
|
+
};
|
|
46
51
|
export declare class AthenaWarehouseClient extends WarehouseBaseClient<CreateAthenaCredentials> {
|
|
47
52
|
client: AthenaClient;
|
|
48
|
-
constructor(credentials: CreateAthenaCredentials);
|
|
53
|
+
constructor(credentials: CreateAthenaCredentials, options?: AthenaWarehouseClientOptions);
|
|
49
54
|
private waitForQueryCompletion;
|
|
50
55
|
private parseValue;
|
|
51
56
|
streamQuery(sql: string, streamCallback: (data: WarehouseResults) => void | Promise<void>, options: {
|
|
@@ -64,4 +69,5 @@ export declare class AthenaWarehouseClient extends WarehouseBaseClient<CreateAth
|
|
|
64
69
|
getFields(tableName: string, schema?: string, database?: string): Promise<WarehouseCatalog>;
|
|
65
70
|
parseError(error: Error): Error;
|
|
66
71
|
}
|
|
72
|
+
export {};
|
|
67
73
|
//# sourceMappingURL=AthenaWarehouseClient.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AthenaWarehouseClient.d.ts","sourceRoot":"","sources":["../../src/warehouseClients/AthenaWarehouseClient.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,YAAY,EAQf,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"AthenaWarehouseClient.d.ts","sourceRoot":"","sources":["../../src/warehouseClients/AthenaWarehouseClient.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,YAAY,EAQf,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,wBAAwB,EAAE,MAAM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,CAAC,eAAe,CAAC,CAwC7C;IAED,OAAO,CAAC,gBAAgB;IASlB,aAAa,IAAI,OAAO,CAAC,wBAAwB,CAAC,CA0CvD;IAEK,oBAAoB,CACtB,cAAc,EAAE,uBAAuB,GACxC,OAAO,CAAC,eAAe,CAAC,CAyC1B;IAEK,SAAS,CACX,SAAS,EAAE,MAAM,EACjB,MAAM,CAAC,EAAE,MAAM,EACf,QAAQ,CAAC,EAAE,MAAM,GAClB,OAAO,CAAC,gBAAgB,CAAC,CAuC3B;IAED,UAAU,CAAC,KAAK,EAAE,KAAK,GAAG,KAAK,CAE9B;CACJ"}
|
|
@@ -230,7 +230,7 @@ exports.AthenaSqlBuilder = AthenaSqlBuilder;
|
|
|
230
230
|
const POLL_INTERVAL_MS = 500;
|
|
231
231
|
const MAX_POLL_ATTEMPTS = 1200; // 10 minutes max wait
|
|
232
232
|
class AthenaWarehouseClient extends WarehouseBaseClient_1.default {
|
|
233
|
-
constructor(credentials) {
|
|
233
|
+
constructor(credentials, options) {
|
|
234
234
|
super(credentials, new AthenaSqlBuilder(credentials.startOfWeek));
|
|
235
235
|
try {
|
|
236
236
|
const authenticationType = credentials.authenticationType ??
|
|
@@ -251,8 +251,19 @@ class AthenaWarehouseClient extends WarehouseBaseClient_1.default {
|
|
|
251
251
|
sessionToken: credentials.sessionToken || undefined,
|
|
252
252
|
};
|
|
253
253
|
}
|
|
254
|
-
|
|
255
|
-
|
|
254
|
+
if (authenticationType === common_1.AthenaAuthenticationType.WEB_IDENTITY) {
|
|
255
|
+
// The server assumes the role with its own identity, so it is
|
|
256
|
+
// not wrapped with a second assume role below. Without server
|
|
257
|
+
// credentials, fail when they're first needed, so a client
|
|
258
|
+
// used only for SQL generation still works.
|
|
259
|
+
clientConfig.credentials =
|
|
260
|
+
options?.awsCredentials ??
|
|
261
|
+
(async () => {
|
|
262
|
+
throw new common_1.WarehouseConnectionError(common_1.AWS_WEB_IDENTITY_NOT_ENABLED_MESSAGE);
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
else if (credentials.assumeRoleArn) {
|
|
266
|
+
// Wrap with assume role if configured
|
|
256
267
|
clientConfig.credentials = (0, credential_providers_1.fromTemporaryCredentials)({
|
|
257
268
|
masterCredentials: clientConfig.credentials,
|
|
258
269
|
params: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lightdash/warehouses",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.431.0",
|
|
4
4
|
"description": "Warehouse connectors for Lightdash",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"@databricks/sql": "1.13.0",
|
|
22
22
|
"@duckdb/node-api": "1.5.2-r.2",
|
|
23
23
|
"@google-cloud/bigquery": "8.3.1",
|
|
24
|
-
"@lightdash/common": "2.
|
|
24
|
+
"@lightdash/common": "2.431.0",
|
|
25
25
|
"node-fetch": "2.7.0",
|
|
26
26
|
"pg": "8.13.1",
|
|
27
27
|
"pg-cursor": "2.10.0",
|