Skip to content

Commit 7df6bac

Browse files
committed
abstract out the bucket type array
1 parent 7c0503f commit 7df6bac

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

packages/cubejs-databricks-jdbc-driver/src/DatabricksDriver.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ import {
2626
import { DatabricksQuery } from './DatabricksQuery';
2727
import { resolveJDBCDriver, extractUidFromJdbcUrl } from './helpers';
2828

29+
const SUPPORTED_BUCKET_TYPES = ['s3', 'gcs', 'azure'];
30+
2931
export type DatabricksDriverConfiguration = JDBCDriverConfiguration &
3032
{
3133
/**
@@ -214,7 +216,7 @@ export class DatabricksDriver extends JDBCDriver {
214216
// common export bucket config
215217
bucketType:
216218
conf?.bucketType ||
217-
getEnv('dbExportBucketType', { supported: ['s3', 'azure', 'gcs'], dataSource }),
219+
getEnv('dbExportBucketType', { supported: SUPPORTED_BUCKET_TYPES, dataSource }),
218220
exportBucket:
219221
conf?.exportBucket ||
220222
getEnv('dbExportBucket', { dataSource }),
@@ -652,7 +654,7 @@ export class DatabricksDriver extends JDBCDriver {
652654
* export bucket data.
653655
*/
654656
public async unload(tableName: string, options: UnloadOptions) {
655-
if (!['azure', 's3', 'gcs'].includes(this.config.bucketType as string)) {
657+
if (!SUPPORTED_BUCKET_TYPES.includes(this.config.bucketType as string)) {
656658
throw new Error(`Unsupported export bucket type: ${
657659
this.config.bucketType
658660
}`);

0 commit comments

Comments
 (0)