Skip to content

Commit

Permalink
fix(databricks-driver): fix databricks bucket URL parsing. Now driver…
Browse files Browse the repository at this point in the history
… supports both (legacy and modern urls) (#8968)

* chore(testing-drivers): update databricks export to azure configuration

* fix azure blobs filtering

* add support for azure 'dfs.core.windows.net' alongside with 'blob.core.windows.net'

* update test snapshots
# Conflicts:
#	packages/cubejs-testing-drivers/test/__snapshots__/databricks-jdbc-export-bucket-azure-full.test.ts.snap
  • Loading branch information
KSDaemon committed Dec 7, 2024
1 parent b20a3ca commit 26c9a27
Show file tree
Hide file tree
Showing 3 changed files with 1,688 additions and 283 deletions.
5 changes: 3 additions & 2 deletions packages/cubejs-base-driver/src/BaseDriver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -751,7 +751,8 @@ export abstract class BaseDriver implements DriverInterface {
bucketName: string,
tableName: string
): Promise<string[]> {
const parts = bucketName.split('.blob.core.windows.net/');
const splitter = bucketName.includes('blob.core') ? '.blob.core.windows.net/' : '.dfs.core.windows.net/';
const parts = bucketName.split(splitter);
const account = parts[0];
const container = parts[1].split('/')[0];
let credential: StorageSharedKeyCredential | DefaultAzureCredential;
Expand Down Expand Up @@ -805,7 +806,7 @@ export abstract class BaseDriver implements DriverInterface {

const csvFiles: string[] = [];
const containerClient = blobServiceClient.getContainerClient(container);
const blobsList = containerClient.listBlobsFlat({ prefix: `${tableName}/` });
const blobsList = containerClient.listBlobsFlat({ prefix: `${tableName}` });
for await (const blob of blobsList) {
if (blob.name && (blob.name.endsWith('.csv.gz') || blob.name.endsWith('.csv'))) {
const starts = new Date();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"cube": {
"environment": {
"CUBEJS_DB_EXPORT_BUCKET_TYPE": "azure",
"CUBEJS_DB_EXPORT_BUCKET": "wasbs://databricks-drivers-tests-preaggs@coreteamdevtest.blob.core.windows.net",
"CUBEJS_DB_EXPORT_BUCKET": "abfss://databricks-drivers-tests-preaggs@coreteamdevtest.dfs.core.windows.net",
"CUBEJS_DB_EXPORT_BUCKET_AZURE_KEY": "${DRIVERS_TESTS_CUBEJS_DB_EXPORT_BUCKET_AZURE_KEY}"
}
}
Expand Down
Loading

0 comments on commit 26c9a27

Please sign in to comment.