Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
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
4 changes: 4 additions & 0 deletions .github/workflows/drivers-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,9 @@ jobs:
clickhouse-export-bucket-s3
databricks-jdbc
databricks-jdbc-export-bucket-s3
databricks-jdbc-export-bucket-s3-prefix
databricks-jdbc-export-bucket-azure
databricks-jdbc-export-bucket-azure-prefix
redshift
redshift-export-bucket-s3
snowflake
Expand All @@ -231,7 +233,9 @@ jobs:
- clickhouse-export-bucket-s3
- databricks-jdbc
- databricks-jdbc-export-bucket-s3
- databricks-jdbc-export-bucket-s3-prefix
- databricks-jdbc-export-bucket-azure
- databricks-jdbc-export-bucket-azure-prefix
- mssql
- mysql
- postgres
Expand Down
11 changes: 9 additions & 2 deletions packages/cubejs-databricks-jdbc-driver/src/DatabricksDriver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -703,6 +703,13 @@ export class DatabricksDriver extends JDBCDriver {
// wasbs://[email protected]
// The extractors in BaseDriver expect just clean bucket name
const url = new URL(this.config.exportBucket || '');
const prefix = url.pathname.slice(1);
let delimiter = '';
if (prefix && !prefix.endsWith('/')) {
delimiter = '/';
}

const objectSearchPrefix = `${prefix}${delimiter}${tableName}`;

if (this.config.bucketType === 'azure') {
const {
Expand All @@ -716,7 +723,7 @@ export class DatabricksDriver extends JDBCDriver {
// Databricks uses different bucket address form, so we need to transform it
// to the one understandable by extractFilesFromAzure implementation
`${url.host}/${url.username}`,
tableName,
objectSearchPrefix,
);
} else if (this.config.bucketType === 's3') {
return this.extractUnloadedFilesFromS3(
Expand All @@ -728,7 +735,7 @@ export class DatabricksDriver extends JDBCDriver {
region: this.config.awsRegion || '',
},
url.host,
tableName,
objectSearchPrefix,
);
} else {
throw new Error(`Unsupported export bucket type: ${
Expand Down
20 changes: 20 additions & 0 deletions packages/cubejs-testing-drivers/fixtures/databricks-jdbc.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,17 @@
}
}
},
"export-bucket-s3-prefix": {
"cube": {
"environment": {
"CUBEJS_DB_EXPORT_BUCKET_TYPE": "s3",
"CUBEJS_DB_EXPORT_BUCKET": "s3://databricks-drivers-tests-preaggs/testing_prefix/for_export_buckets/",
"CUBEJS_DB_EXPORT_BUCKET_AWS_KEY": "${DRIVERS_TESTS_CUBEJS_DB_EXPORT_BUCKET_AWS_KEY}",
"CUBEJS_DB_EXPORT_BUCKET_AWS_SECRET": "${DRIVERS_TESTS_CUBEJS_DB_EXPORT_BUCKET_AWS_SECRET}",
"CUBEJS_DB_EXPORT_BUCKET_AWS_REGION": "us-east-1"
}
}
},
"export-bucket-azure": {
"cube": {
"environment": {
Expand All @@ -19,6 +30,15 @@
"CUBEJS_DB_EXPORT_BUCKET_AZURE_KEY": "${DRIVERS_TESTS_CUBEJS_DB_EXPORT_BUCKET_AZURE_KEY}"
}
}
},
"export-bucket-azure-prefix": {
"cube": {
"environment": {
"CUBEJS_DB_EXPORT_BUCKET_TYPE": "azure",
"CUBEJS_DB_EXPORT_BUCKET": "abfss://databricks-drivers-tests-preaggs@coreteamdevtest.dfs.core.windows.net/testing_prefix/for_export_buckets",
"CUBEJS_DB_EXPORT_BUCKET_AZURE_KEY": "${DRIVERS_TESTS_CUBEJS_DB_EXPORT_BUCKET_AZURE_KEY}"
}
}
}
},
"cube": {
Expand Down
2 changes: 2 additions & 0 deletions packages/cubejs-testing-drivers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@
"databricks-jdbc-core": "yarn test-driver -i dist/test/databricks-jdbc-core.test.js",
"databricks-jdbc-full": "yarn test-driver -i dist/test/databricks-jdbc-full.test.js",
"databricks-jdbc-export-bucket-s3-full": "yarn test-driver -i dist/test/databricks-jdbc-export-bucket-s3-full.test.js",
"databricks-jdbc-export-bucket-s3-prefix-full": "yarn test-driver -i dist/test/databricks-jdbc-export-bucket-s3-prefix-full.test.js",
"databricks-jdbc-export-bucket-azure-full": "yarn test-driver -i dist/test/databricks-jdbc-export-bucket-azure-full.test.js",
"databricks-jdbc-export-bucket-azure-prefix-full": "yarn test-driver -i dist/test/databricks-jdbc-export-bucket-azure-prefix-full.test.js",
"mssql-driver": "yarn test-driver -i dist/test/mssql-driver.test.js",
"mssql-core": "yarn test-driver -i dist/test/mssql-core.test.js",
"mssql-full": "yarn test-driver -i dist/test/mssql-full.test.js",
Expand Down
Loading