Skip to content

Commit d7ffdca

Browse files
committed
fix(databricks-jdbc-driver): Allow paths in s3/azure export buckets
1 parent 2fffada commit d7ffdca

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

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

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -703,6 +703,13 @@ export class DatabricksDriver extends JDBCDriver {
703703
// wasbs://[email protected]
704704
// The extractors in BaseDriver expect just clean bucket name
705705
const url = new URL(this.config.exportBucket || '');
706+
const prefix = url.pathname.slice(1);
707+
let delimiter = '';
708+
if (prefix && !prefix.endsWith('/')) {
709+
delimiter = '/';
710+
}
711+
712+
const objectSearchPrefix = `${prefix}${delimiter}${tableName}`;
706713

707714
if (this.config.bucketType === 'azure') {
708715
const {
@@ -716,7 +723,7 @@ export class DatabricksDriver extends JDBCDriver {
716723
// Databricks uses different bucket address form, so we need to transform it
717724
// to the one understandable by extractFilesFromAzure implementation
718725
`${url.host}/${url.username}`,
719-
tableName,
726+
objectSearchPrefix,
720727
);
721728
} else if (this.config.bucketType === 's3') {
722729
return this.extractUnloadedFilesFromS3(
@@ -728,7 +735,7 @@ export class DatabricksDriver extends JDBCDriver {
728735
region: this.config.awsRegion || '',
729736
},
730737
url.host,
731-
tableName,
738+
objectSearchPrefix,
732739
);
733740
} else {
734741
throw new Error(`Unsupported export bucket type: ${

0 commit comments

Comments
 (0)