Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions packages/cubejs-prestodb-driver/src/PrestoDriver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const presto = require('presto-client');

export type PrestoDriverExportBucket = {
exportBucket?: string,
bucketType?: 'gcs',
bucketType?: 'gcs' | 's3',
credentials?: any,
exportBucketCsvEscapeSymbol?: string,
};
Expand All @@ -50,7 +50,7 @@ export type PrestoDriverConfiguration = PrestoDriverExportBucket & {
queryTimeout?: number;
};

const SUPPORTED_BUCKET_TYPES = ['gcs'];
const SUPPORTED_BUCKET_TYPES = ['gcs', 's3'];
/**
* Presto driver class.
*/
Expand Down Expand Up @@ -103,7 +103,7 @@ export class PrestoDriver extends BaseDriver implements DriverInterface {
...(authToken ? { custom_auth: `Bearer ${authToken}` } : {}),
...(dbPassword ? { basic_auth: { user: dbUser, password: dbPassword } } : {}),
ssl: this.getSslOptions(dataSource),
bucketType: getEnv('dbExportBucketType', { supported: ['gcs'], dataSource }),
bucketType: getEnv('dbExportBucketType', { supported: SUPPORTED_BUCKET_TYPES, dataSource }),
exportBucket: getEnv('dbExportBucket', { dataSource }),
credentials: getEnv('dbExportGCSCredentials', { dataSource }),
...config
Expand Down Expand Up @@ -351,6 +351,8 @@ export class PrestoDriver extends BaseDriver implements DriverInterface {
switch (bucketType) {
case 'gcs':
return this.extractFilesFromGCS({ credentials }, exportBucket, `${schema}/${tableName}`);
case 's3':
return this.extractUnloadedFilesFromS3({ credentials }, exportBucket, `${schema}/${tableName}`);
default:
throw new Error(`Unsupported export bucket type: ${bucketType}`);
}
Expand Down
Loading