Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion packages/databricks-vscode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1975,7 +1975,7 @@
"useYarn": false
},
"cli": {
"version": "1.24.0"
"version": "1.27.0"
},
"scripts": {
"vscode:prepublish": "rm -rf out && yarn run package:compile && yarn run package:wrappers:write && yarn run package:jupyter-init-script:write && yarn run package:copy-webview-toolkit && yarn run package:copy-markdown-it && yarn run package:copy-highlight && yarn run generate-telemetry",
Expand Down
11 changes: 3 additions & 8 deletions packages/databricks-vscode/src/bundle/BundlePipelinesManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,9 @@ export class BundlePipelinesManager {
}
});
const picks = await waitForPicks(ui, disposables);
const selectedTables = picksToString(picks);
const selectedTables = picks
?.filter((p) => p.isDataset)
.map((p) => p.label);
disposables.forEach((d) => d.dispose());
ui.dispose();
isUIVisible = false;
Expand Down Expand Up @@ -534,13 +536,6 @@ function createPicks(datasets: Set<string>, manualValue?: string) {
return {allPicks, fullRefreshPick};
}

function picksToString(picks?: readonly Pick[]): string | undefined {
return picks
?.filter((p) => p.isDataset)
.map((p) => p.label)
.join(",");
}

function stringToDatasets(str: string): Set<string> {
const list = str
.split(",")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import assert from "node:assert/strict";
import {pipelineRefreshArgs} from "./BundleCommands";

describe("pipelineRefreshArgs", () => {
for (const fullRefresh of [false, true]) {
const flag = fullRefresh ? "--full-refresh" : "--refresh";
it(`passes one ${flag} per selected table`, () => {
assert.deepEqual(
pipelineRefreshArgs(
[
"orders",
"sales.order details",
"`a.b`.`x,y`",
"file:archive",
"a`b",
],
fullRefresh
),
[
flag,
"orders",
flag,
"sales.`order details`",
flag,
"`a.b`.`x,y`",
flag,
"`file:archive`",
flag,
"`a``b`",
]
);
});
}
});
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,23 @@ function isRunnable(treeNode: ResourceData): treeNode is RunnableTreeNodes {
return (RUNNABLE_BUNDLE_RESOURCES as string[]).includes(treeNode.type);
}

export function pipelineRefreshArgs(
tables: string[],
fullRefresh: boolean
): string[] {
const flag = fullRefresh ? "--full-refresh" : "--refresh";
return tables.flatMap((table) => {
// Keep qualified SQL identifiers intact when a component needs quoting.
const selector = table.replace(/`(?:``|[^`])*`|[^.]+/g, (part) => {
if (/^`(?:``|[^`])*`$/.test(part) || !/[\s,:`]/.test(part)) {
return part;
}
return "`" + part.replace(/`/g, "``") + "`";
});
return [flag, selector];
});
}

export class BundleCommands implements Disposable {
private disposables: Disposable[] = [];

Expand Down Expand Up @@ -286,10 +303,7 @@ export class BundleCommands implements Disposable {
}
return this.deployAndRun(
treeNode,
[
result.fullRefresh ? "--full-refresh" : "--refresh",
result.tables,
],
pipelineRefreshArgs(result.tables, result.fullRefresh),
"partial-refresh"
);
}
Expand Down
Loading