dataiku-sdk 3.3.0 → 3.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -4
- package/dist/build-metadata.json +1 -1
- package/dist/src/cli/command-syntax.json +14524 -0
- package/dist/src/cli/commands/analysis.js +6 -9
- package/dist/src/cli/commands/api-deployer.js +15 -33
- package/dist/src/cli/commands/api-service.js +17 -27
- package/dist/src/cli/commands/app.js +22 -39
- package/dist/src/cli/commands/bundle.js +15 -24
- package/dist/src/cli/commands/business-app.js +10 -17
- package/dist/src/cli/commands/code-env.js +23 -36
- package/dist/src/cli/commands/code.js +5 -5
- package/dist/src/cli/commands/connection.js +12 -22
- package/dist/src/cli/commands/continuous-activity.js +6 -9
- package/dist/src/cli/commands/dashboard.js +8 -13
- package/dist/src/cli/commands/data-collection.js +9 -16
- package/dist/src/cli/commands/data-quality.js +14 -26
- package/dist/src/cli/commands/dataset.js +28 -51
- package/dist/src/cli/commands/discussion.js +7 -10
- package/dist/src/cli/commands/doctor.js +3 -3
- package/dist/src/cli/commands/flow-zone.js +8 -17
- package/dist/src/cli/commands/folder.js +12 -20
- package/dist/src/cli/commands/future.js +7 -10
- package/dist/src/cli/commands/group.js +7 -11
- package/dist/src/cli/commands/insight.js +7 -11
- package/dist/src/cli/commands/job.js +17 -25
- package/dist/src/cli/commands/knowledge-bank.js +5 -6
- package/dist/src/cli/commands/llm.js +5 -8
- package/dist/src/cli/commands/macro.js +11 -18
- package/dist/src/cli/commands/meaning.js +7 -11
- package/dist/src/cli/commands/metrics.js +7 -10
- package/dist/src/cli/commands/ml-task.js +12 -20
- package/dist/src/cli/commands/model-evaluation-store.js +7 -11
- package/dist/src/cli/commands/notebook.js +15 -27
- package/dist/src/cli/commands/plugin.js +35 -68
- package/dist/src/cli/commands/project-deployer.js +10 -22
- package/dist/src/cli/commands/project-folder.js +10 -17
- package/dist/src/cli/commands/project-git.js +39 -71
- package/dist/src/cli/commands/project-library.js +15 -23
- package/dist/src/cli/commands/project.js +9 -26
- package/dist/src/cli/commands/recipe.d.ts +16 -0
- package/dist/src/cli/commands/recipe.js +83 -94
- package/dist/src/cli/commands/saved-model.js +23 -39
- package/dist/src/cli/commands/scenario.js +21 -35
- package/dist/src/cli/commands/sql.js +4 -4
- package/dist/src/cli/commands/statistics.js +11 -18
- package/dist/src/cli/commands/streaming-endpoint.js +7 -11
- package/dist/src/cli/commands/user.js +11 -22
- package/dist/src/cli/commands/variable.js +3 -4
- package/dist/src/cli/commands/webapp.js +10 -16
- package/dist/src/cli/commands/wiki.js +9 -13
- package/dist/src/cli/commands/workspace.js +8 -14
- package/dist/src/cli/contract.d.ts +5 -15
- package/dist/src/cli/contract.js +179 -461
- package/dist/src/cli/doctor.js +1 -0
- package/dist/src/cli/env.d.ts +2 -0
- package/dist/src/cli/env.js +15 -1
- package/dist/src/cli/helpers/app-permissions.js +2 -1
- package/dist/src/cli/helpers/flow-zone.js +2 -1
- package/dist/src/cli/helpers/recipe.js +2 -1
- package/dist/src/cli/output-schemas.d.ts +24 -0
- package/dist/src/cli/output-schemas.js +233 -0
- package/dist/src/cli/syntax.d.ts +83 -0
- package/dist/src/cli/syntax.js +217 -0
- package/dist/src/cli/types.d.ts +3 -0
- package/dist/src/cli/usage.d.ts +1 -1
- package/dist/src/cli/usage.js +4 -2
- package/dist/src/cli/version.js +2 -0
- package/dist/src/cli.js +37 -64
- package/dist/src/client.d.ts +10 -1
- package/dist/src/client.js +27 -11
- package/dist/src/errors.d.ts +12 -1
- package/dist/src/errors.js +34 -7
- package/dist/src/generated/action-output-schemas.json +1735 -0
- package/dist/src/index.d.ts +1 -3
- package/dist/src/index.js +2 -2
- package/dist/src/resources/api-services.js +2 -3
- package/dist/src/resources/applications.js +2 -4
- package/dist/src/resources/code-envs.js +2 -2
- package/dist/src/resources/data-quality.js +4 -3
- package/dist/src/resources/datasets.d.ts +13 -0
- package/dist/src/resources/datasets.js +42 -8
- package/dist/src/resources/flow-zones.d.ts +6 -2
- package/dist/src/resources/flow-zones.js +10 -5
- package/dist/src/resources/folders.js +4 -2
- package/dist/src/resources/futures.d.ts +2 -0
- package/dist/src/resources/futures.js +39 -27
- package/dist/src/resources/insights.js +3 -2
- package/dist/src/resources/jobs.js +41 -31
- package/dist/src/resources/macros.js +2 -4
- package/dist/src/resources/ml-tasks.js +28 -19
- package/dist/src/resources/notebooks.js +2 -3
- package/dist/src/resources/plugins.d.ts +0 -2
- package/dist/src/resources/plugins.js +0 -3
- package/dist/src/resources/project-git.d.ts +6 -12
- package/dist/src/resources/project-git.js +31 -58
- package/dist/src/resources/project-library.d.ts +0 -2
- package/dist/src/resources/project-library.js +2 -7
- package/dist/src/resources/projects.d.ts +4 -2
- package/dist/src/resources/projects.js +37 -36
- package/dist/src/resources/recipes.d.ts +28 -0
- package/dist/src/resources/recipes.js +116 -84
- package/dist/src/resources/sql.js +8 -3
- package/dist/src/resources/statistics.js +2 -1
- package/dist/src/resources/variables.js +2 -1
- package/dist/src/resources/webapps.js +2 -3
- package/dist/src/schemas.d.ts +1 -2
- package/dist/src/schemas.js +1 -1
- package/dist/src/skill.js +6 -7
- package/dist/src/utils/cleanup-ledger.js +9 -8
- package/dist/src/utils/git-reference.d.ts +12 -0
- package/dist/src/utils/git-reference.js +38 -0
- package/dist/src/utils/polling.d.ts +3 -0
- package/dist/src/utils/polling.js +3 -0
- package/dist/src/utils/project-archive.js +2 -2
- package/dist/src/utils/stable-hash.d.ts +3 -1
- package/dist/src/utils/stable-hash.js +2 -0
- package/package.json +8 -8
- package/plugin.json +1 -1
- package/skills/dataiku-dss/SKILL.md +3 -2
- package/skills/dataiku-dss/references/app-releases.md +2 -3
- package/skills/dataiku-dss/references/authentication.md +7 -7
- package/skills/dataiku-dss/references/coding.md +1 -1
- package/skills/dataiku-dss/references/mutations.md +1 -1
- package/skills/dataiku-dss/references/troubleshooting.md +2 -2
- package/dist/src/utils/pagination.d.ts +0 -8
- package/dist/src/utils/pagination.js +0 -23
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { macroResultMaxBytes, } from "../../resources/macros.js";
|
|
2
1
|
import { jsonInput, num, } from "../coerce.js";
|
|
3
2
|
import { executionMode, } from "../flags.js";
|
|
4
3
|
import { encodedProjectEndpoint, } from "../output.js";
|
|
4
|
+
import { commandUsage, withUsage, } from "../syntax.js";
|
|
5
5
|
import { requireArgs, UsageError, } from "../usage.js";
|
|
6
|
-
const MACRO_RUN_USAGE = "dss macro run <macro_id> [--wait] [--timeout MS (default 120000)] [--poll-interval MS] [--data JSON] [--dry-run] [--project-key KEY]";
|
|
7
6
|
/**
|
|
8
7
|
* Flags accepted by run/run-and-wait; validated identically for live, dry-run,
|
|
9
8
|
* and --plan so a plan that would fail cannot be "fixed" by dropping flags.
|
|
@@ -66,28 +65,26 @@ function requireNotBlankId(value, usage) {
|
|
|
66
65
|
throw new UsageError(`Macro/run id must be non-empty. Usage: ${usage}`);
|
|
67
66
|
}
|
|
68
67
|
}
|
|
69
|
-
export const macroCommands = {
|
|
68
|
+
export const macroCommands = withUsage("macro", {
|
|
70
69
|
list: {
|
|
71
70
|
handler: (c, _a, f) => c.macros.list(f["project-key"]),
|
|
72
|
-
usage: "dss macro list [--project-key KEY]",
|
|
73
71
|
description: "List the macros (runnables) available in a project.",
|
|
74
72
|
examples: ["dss macro list",],
|
|
75
73
|
},
|
|
76
74
|
get: {
|
|
77
75
|
handler: (c, a, f) => {
|
|
78
|
-
requireArgs(a, 1, "
|
|
76
|
+
requireArgs(a, 1, commandUsage("macro", "get"));
|
|
79
77
|
requireNotBlankId(a[0], "dss macro get <macro_id>");
|
|
80
78
|
return c.macros.definition(a[0], {
|
|
81
79
|
projectKey: f["project-key"],
|
|
82
80
|
});
|
|
83
81
|
},
|
|
84
|
-
usage: "dss macro get <macro_id> [--project-key KEY]",
|
|
85
82
|
description: "Get a macro's definition: parameters, result type, owning plugin, labels.",
|
|
86
83
|
examples: ["dss macro get compute_orders",],
|
|
87
84
|
},
|
|
88
85
|
run: {
|
|
89
86
|
handler: async (c, a, f) => {
|
|
90
|
-
requireArgs(a, 1, "
|
|
87
|
+
requireArgs(a, 1, commandUsage("macro", "run"));
|
|
91
88
|
const pk = f["project-key"];
|
|
92
89
|
const waitOptions = macroWaitOptionsFromFlags(f);
|
|
93
90
|
const runParams = macroRunParamsFromFlags(f);
|
|
@@ -117,7 +114,6 @@ export const macroCommands = {
|
|
|
117
114
|
}
|
|
118
115
|
return c.macros.run(a[0], { ...runParams, projectKey: pk, });
|
|
119
116
|
},
|
|
120
|
-
usage: MACRO_RUN_USAGE,
|
|
121
117
|
description: "Start a macro run. Macros execute arbitrary plugin code and are classified destructive. --wait polls to completion and exits 4 on failure; without it only the runId is returned. --data JSON may carry { params: {...}, adminParams: {...} } for parameterized macros.",
|
|
122
118
|
examples: [
|
|
123
119
|
"dss macro run compute_orders",
|
|
@@ -128,7 +124,7 @@ export const macroCommands = {
|
|
|
128
124
|
},
|
|
129
125
|
"run-and-wait": {
|
|
130
126
|
handler: async (c, a, f) => {
|
|
131
|
-
requireArgs(a, 1, "
|
|
127
|
+
requireArgs(a, 1, commandUsage("macro", "run-and-wait"));
|
|
132
128
|
const pk = f["project-key"];
|
|
133
129
|
const waitOptions = macroWaitOptionsFromFlags(f);
|
|
134
130
|
const runParams = macroRunParamsFromFlags(f);
|
|
@@ -155,7 +151,6 @@ export const macroCommands = {
|
|
|
155
151
|
projectKey: pk,
|
|
156
152
|
});
|
|
157
153
|
},
|
|
158
|
-
usage: "dss macro run-and-wait <macro_id> [--timeout MS (default 120000)] [--poll-interval MS] [--data JSON] [--dry-run] [--project-key KEY]",
|
|
159
154
|
description: "Run a macro and poll its state until it finishes. Exits 4 on failure; returns { success: false, timedOut: true } on timeout.",
|
|
160
155
|
examples: [
|
|
161
156
|
"dss macro run-and-wait compute_orders",
|
|
@@ -164,7 +159,7 @@ export const macroCommands = {
|
|
|
164
159
|
},
|
|
165
160
|
abort: {
|
|
166
161
|
handler: async (c, a, f) => {
|
|
167
|
-
requireArgs(a, 2, "
|
|
162
|
+
requireArgs(a, 2, commandUsage("macro", "abort"));
|
|
168
163
|
requireNotBlankId(a[0], "dss macro abort <macro_id> <run_id>");
|
|
169
164
|
requireNotBlankId(a[1], "dss macro abort <macro_id> <run_id>");
|
|
170
165
|
const pk = f["project-key"];
|
|
@@ -182,26 +177,24 @@ export const macroCommands = {
|
|
|
182
177
|
await c.macros.abort(a[0], a[1], pk);
|
|
183
178
|
return { aborted: a[1], runId: a[1], resource: "macro", };
|
|
184
179
|
},
|
|
185
|
-
usage: "dss macro abort <macro_id> <run_id> [--dry-run] [--project-key KEY]",
|
|
186
180
|
description: "Request abort of a running macro run.",
|
|
187
181
|
examples: ["dss macro abort compute_orders run_42",],
|
|
188
182
|
},
|
|
189
183
|
state: {
|
|
190
184
|
handler: (c, a, f) => {
|
|
191
|
-
requireArgs(a, 2, "
|
|
185
|
+
requireArgs(a, 2, commandUsage("macro", "state"));
|
|
192
186
|
requireNotBlankId(a[0], "dss macro state <macro_id> <run_id>");
|
|
193
187
|
requireNotBlankId(a[1], "dss macro state <macro_id> <run_id>");
|
|
194
188
|
return c.macros.state(a[0], a[1], {
|
|
195
189
|
projectKey: f["project-key"],
|
|
196
190
|
});
|
|
197
191
|
},
|
|
198
|
-
usage: "dss macro state <macro_id> <run_id> [--project-key KEY]",
|
|
199
192
|
description: "Get the poll state of a macro run: running flag, progress stack, failure details.",
|
|
200
193
|
examples: ["dss macro state compute_orders run_42",],
|
|
201
194
|
},
|
|
202
195
|
result: {
|
|
203
196
|
handler: async (c, a, f) => {
|
|
204
|
-
requireArgs(a, 2, "
|
|
197
|
+
requireArgs(a, 2, commandUsage("macro", "result"));
|
|
205
198
|
requireNotBlankId(a[0], "dss macro result <macro_id> <run_id>");
|
|
206
199
|
requireNotBlankId(a[1], "dss macro result <macro_id> <run_id>");
|
|
207
200
|
const pk = f["project-key"];
|
|
@@ -211,11 +204,11 @@ export const macroCommands = {
|
|
|
211
204
|
}
|
|
212
205
|
return c.macros.result(a[0], a[1], {
|
|
213
206
|
projectKey: pk,
|
|
214
|
-
maxBytes:
|
|
207
|
+
maxBytes: require("../../resources/macros.js")
|
|
208
|
+
.macroResultMaxBytes(maxBytes),
|
|
215
209
|
});
|
|
216
210
|
},
|
|
217
|
-
usage: "dss macro result <macro_id> <run_id> [--max-bytes N (default 8388608)] [--project-key KEY]",
|
|
218
211
|
description: "Download a macro run's result. Text/HTML bodies print as a JSON string (stdout stays one JSON document, embedded newlines escaped); JSON bodies print as the parsed object.",
|
|
219
212
|
examples: ["dss macro result compute_orders run_42", "dss macro result m r --max-bytes 1024",],
|
|
220
213
|
},
|
|
221
|
-
};
|
|
214
|
+
});
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsonInput, requiredJsonInput, } from "../coerce.js";
|
|
2
2
|
import { executionMode, } from "../flags.js";
|
|
3
3
|
import { isNotFoundError, planResult, skipResult, } from "../output.js";
|
|
4
|
+
import { commandUsage, withUsage, } from "../syntax.js";
|
|
4
5
|
import { requireArgs, } from "../usage.js";
|
|
5
6
|
const MEANING_PLAN_FAILURE_CODES = { usage: 1, error: 2, transient: 3, };
|
|
6
7
|
function meaningEndpoint(meaningId) {
|
|
@@ -20,25 +21,23 @@ function meaningCreatePayload(id, label, type, body) {
|
|
|
20
21
|
detectable: body.detectable ?? false,
|
|
21
22
|
};
|
|
22
23
|
}
|
|
23
|
-
export const meaningCommands = {
|
|
24
|
+
export const meaningCommands = withUsage("meaning", {
|
|
24
25
|
list: {
|
|
25
26
|
handler: (c) => c.meanings.list(),
|
|
26
|
-
usage: "dss meaning list",
|
|
27
27
|
description: "List user-defined meanings (column semantic types) on the instance.",
|
|
28
28
|
examples: ["dss meaning list",],
|
|
29
29
|
},
|
|
30
30
|
get: {
|
|
31
31
|
handler: (c, a) => {
|
|
32
|
-
requireArgs(a, 1, "
|
|
32
|
+
requireArgs(a, 1, commandUsage("meaning", "get"));
|
|
33
33
|
return c.meanings.get(a[0]);
|
|
34
34
|
},
|
|
35
|
-
usage: "dss meaning get <meaningId>",
|
|
36
35
|
description: "Get a user-defined meaning definition.",
|
|
37
36
|
examples: ["dss meaning get customer_type",],
|
|
38
37
|
},
|
|
39
38
|
create: {
|
|
40
39
|
handler: async (c, a, f) => {
|
|
41
|
-
requireArgs(a, 3, "
|
|
40
|
+
requireArgs(a, 3, commandUsage("meaning", "create"));
|
|
42
41
|
const body = jsonInput(f) ?? {};
|
|
43
42
|
const payload = meaningCreatePayload(a[0], a[1], a[2], body);
|
|
44
43
|
if (executionMode(f).dryRun) {
|
|
@@ -55,13 +54,12 @@ export const meaningCommands = {
|
|
|
55
54
|
}
|
|
56
55
|
return c.meanings.create(a[0], a[1], a[2], body);
|
|
57
56
|
},
|
|
58
|
-
usage: "dss meaning create <id> <label> <type> [--data JSON|--data-file PATH|--stdin] [--dry-run]",
|
|
59
57
|
description: "Create a user-defined meaning (type e.g. VALUES_LIST, VALUES_MAPPING, PATTERN).",
|
|
60
58
|
examples: ["dss meaning create vip VIP VALUES_LIST --dry-run",],
|
|
61
59
|
},
|
|
62
60
|
update: {
|
|
63
61
|
handler: async (c, a, f) => {
|
|
64
|
-
requireArgs(a, 1, "
|
|
62
|
+
requireArgs(a, 1, commandUsage("meaning", "update"));
|
|
65
63
|
const body = requiredJsonInput(f, "--data, --data-file, or --stdin is required (meaning definition).");
|
|
66
64
|
if (executionMode(f).dryRun) {
|
|
67
65
|
return planResult("meaning", "update", {
|
|
@@ -77,13 +75,12 @@ export const meaningCommands = {
|
|
|
77
75
|
}
|
|
78
76
|
return c.meanings.update(a[0], body);
|
|
79
77
|
},
|
|
80
|
-
usage: "dss meaning update <meaningId> (--data JSON|--data-file PATH|--stdin) [--dry-run]",
|
|
81
78
|
description: "Replace a user-defined meaning definition.",
|
|
82
79
|
examples: ["dss meaning update vip --data-file meaning.json --dry-run",],
|
|
83
80
|
},
|
|
84
81
|
delete: {
|
|
85
82
|
handler: async (c, a, f) => {
|
|
86
|
-
requireArgs(a, 1, "
|
|
83
|
+
requireArgs(a, 1, commandUsage("meaning", "delete"));
|
|
87
84
|
if (executionMode(f).dryRun || f["if-exists"] === true) {
|
|
88
85
|
const current = await c.meanings.get(a[0]).catch((error) => {
|
|
89
86
|
if (isNotFoundError(error)
|
|
@@ -109,8 +106,7 @@ export const meaningCommands = {
|
|
|
109
106
|
await c.meanings.delete(a[0]);
|
|
110
107
|
return { deleted: a[0], resource: "meaning", };
|
|
111
108
|
},
|
|
112
|
-
usage: "dss meaning delete <meaningId> [--if-exists] [--dry-run]",
|
|
113
109
|
description: "Delete a user-defined meaning definition.",
|
|
114
110
|
examples: ["dss meaning delete vip --dry-run",],
|
|
115
111
|
},
|
|
116
|
-
};
|
|
112
|
+
});
|
|
@@ -1,39 +1,36 @@
|
|
|
1
|
+
import { commandUsage, withUsage, } from "../syntax.js";
|
|
1
2
|
import { requireArgs, } from "../usage.js";
|
|
2
|
-
export const metricsCommands = {
|
|
3
|
+
export const metricsCommands = withUsage("metrics", {
|
|
3
4
|
"dataset-get": {
|
|
4
5
|
handler: (c, a, f) => {
|
|
5
|
-
requireArgs(a, 1, "
|
|
6
|
+
requireArgs(a, 1, commandUsage("metrics", "dataset-get"));
|
|
6
7
|
return c.metrics.getDatasetMetrics(a[0], f["project-key"]);
|
|
7
8
|
},
|
|
8
|
-
usage: "dss metrics dataset-get <dataset> [--project-key KEY]",
|
|
9
9
|
description: "Get the last computed metric values for a dataset.",
|
|
10
10
|
examples: ["dss metrics dataset-get customers",],
|
|
11
11
|
},
|
|
12
12
|
"dataset-compute": {
|
|
13
13
|
handler: (c, a, f) => {
|
|
14
|
-
requireArgs(a, 1, "
|
|
14
|
+
requireArgs(a, 1, commandUsage("metrics", "dataset-compute"));
|
|
15
15
|
return c.metrics.computeDatasetMetrics(a[0], f["project-key"]);
|
|
16
16
|
},
|
|
17
|
-
usage: "dss metrics dataset-compute <dataset> [--project-key KEY]",
|
|
18
17
|
description: "Compute the DSS-configured metrics for a dataset.",
|
|
19
18
|
examples: ["dss metrics dataset-compute customers",],
|
|
20
19
|
},
|
|
21
20
|
"dataset-history": {
|
|
22
21
|
handler: (c, a, f) => {
|
|
23
|
-
requireArgs(a, 2, "
|
|
22
|
+
requireArgs(a, 2, commandUsage("metrics", "dataset-history"));
|
|
24
23
|
return c.metrics.getDatasetMetricHistory(a[0], a[1], f["project-key"]);
|
|
25
24
|
},
|
|
26
|
-
usage: "dss metrics dataset-history <dataset> <metricId> [--project-key KEY]",
|
|
27
25
|
description: "Get the history of one dataset metric.",
|
|
28
26
|
examples: ["dss metrics dataset-history customers records:COUNT_RECORDS",],
|
|
29
27
|
},
|
|
30
28
|
"folder-get": {
|
|
31
29
|
handler: (c, a, f) => {
|
|
32
|
-
requireArgs(a, 1, "
|
|
30
|
+
requireArgs(a, 1, commandUsage("metrics", "folder-get"));
|
|
33
31
|
return c.metrics.getFolderMetrics(a[0], f["project-key"]);
|
|
34
32
|
},
|
|
35
|
-
usage: "dss metrics folder-get <folderId> [--project-key KEY]",
|
|
36
33
|
description: "Get the last computed metric values for a managed folder.",
|
|
37
34
|
examples: ["dss metrics folder-get aBcDeFgH",],
|
|
38
35
|
},
|
|
39
|
-
};
|
|
36
|
+
});
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { num, requiredJsonInput, requiredStringFlag, } from "../coerce.js";
|
|
2
2
|
import { executionMode, } from "../flags.js";
|
|
3
|
+
import { commandUsage, withUsage, } from "../syntax.js";
|
|
3
4
|
import { requireArgs, UsageError, } from "../usage.js";
|
|
4
5
|
function optionalStringFlag(flags, name) {
|
|
5
6
|
const value = flags[name];
|
|
@@ -16,10 +17,10 @@ function taskType(flags, usage) {
|
|
|
16
17
|
return normalized;
|
|
17
18
|
throw new UsageError("--task-type must be PREDICTION or CLUSTERING.", "invalid_enum");
|
|
18
19
|
}
|
|
19
|
-
export const mlTaskCommands = {
|
|
20
|
+
export const mlTaskCommands = withUsage("ml-task", {
|
|
20
21
|
create: {
|
|
21
22
|
handler: async (c, a, f) => {
|
|
22
|
-
const usage = "
|
|
23
|
+
const usage = commandUsage("ml-task", "create");
|
|
23
24
|
requireArgs(a, 1, usage);
|
|
24
25
|
const projectKey = f["project-key"];
|
|
25
26
|
const normalizedTaskType = taskType(f, usage);
|
|
@@ -39,7 +40,6 @@ export const mlTaskCommands = {
|
|
|
39
40
|
const created = await c.mlTasks.create(options);
|
|
40
41
|
return { created: created.mlTaskId, resource: "ml-task", analysisId: a[0], ...created, };
|
|
41
42
|
},
|
|
42
|
-
usage: "dss ml-task create <analysisId> --task-type PREDICTION|CLUSTERING [--target COLUMN] [--prediction-type TYPE] [--backend-type TYPE] [--guess-policy POLICY] [--project-key KEY]",
|
|
43
43
|
description: "Create a prediction or clustering task in an analysis.",
|
|
44
44
|
examples: [
|
|
45
45
|
"dss ml-task create ANALYSIS_ID --task-type prediction --target churn --project-key PROJECT",
|
|
@@ -47,31 +47,28 @@ export const mlTaskCommands = {
|
|
|
47
47
|
},
|
|
48
48
|
status: {
|
|
49
49
|
handler: (c, a, f) => {
|
|
50
|
-
requireArgs(a, 2, "
|
|
50
|
+
requireArgs(a, 2, commandUsage("ml-task", "status"));
|
|
51
51
|
return c.mlTasks.status(a[0], a[1], f["project-key"]);
|
|
52
52
|
},
|
|
53
|
-
usage: "dss ml-task status <analysisId> <mlTaskId> [--project-key KEY]",
|
|
54
53
|
description: "Get a Visual ML task's current status.",
|
|
55
54
|
examples: ["dss ml-task status ANALYSIS_ID TASK_ID --project-key PROJECT",],
|
|
56
55
|
},
|
|
57
56
|
"get-settings": {
|
|
58
57
|
handler: (c, a, f) => {
|
|
59
|
-
requireArgs(a, 2, "
|
|
58
|
+
requireArgs(a, 2, commandUsage("ml-task", "get-settings"));
|
|
60
59
|
return c.mlTasks.getSettings(a[0], a[1], f["project-key"]);
|
|
61
60
|
},
|
|
62
|
-
usage: "dss ml-task get-settings <analysisId> <mlTaskId> [--project-key KEY]",
|
|
63
61
|
description: "Get a Visual ML task's settings.",
|
|
64
62
|
examples: ["dss ml-task get-settings ANALYSIS_ID TASK_ID --project-key PROJECT",],
|
|
65
63
|
},
|
|
66
64
|
"set-settings": {
|
|
67
65
|
handler: (c, a, f) => {
|
|
68
|
-
const usage = "
|
|
66
|
+
const usage = commandUsage("ml-task", "set-settings");
|
|
69
67
|
requireArgs(a, 2, usage);
|
|
70
68
|
const settings = requiredJsonInput(f, "--data, --data-file, or --stdin is required (ML task settings).");
|
|
71
69
|
const projectKey = f["project-key"];
|
|
72
70
|
return c.mlTasks.saveSettings(a[0], a[1], settings, projectKey);
|
|
73
71
|
},
|
|
74
|
-
usage: "dss ml-task set-settings <analysisId> <mlTaskId> (--data JSON|--data-file PATH|--stdin) [--project-key KEY]",
|
|
75
72
|
description: "Replace a Visual ML task's settings from JSON input.",
|
|
76
73
|
examples: [
|
|
77
74
|
"dss ml-task set-settings ANALYSIS_ID TASK_ID --data-file settings.json --project-key PROJECT",
|
|
@@ -79,7 +76,7 @@ export const mlTaskCommands = {
|
|
|
79
76
|
},
|
|
80
77
|
train: {
|
|
81
78
|
handler: async (c, a, f) => {
|
|
82
|
-
const usage = "
|
|
79
|
+
const usage = commandUsage("ml-task", "train");
|
|
83
80
|
requireArgs(a, 2, usage);
|
|
84
81
|
const options = {
|
|
85
82
|
analysisId: a[0],
|
|
@@ -100,7 +97,6 @@ export const mlTaskCommands = {
|
|
|
100
97
|
}
|
|
101
98
|
return c.mlTasks.train(options);
|
|
102
99
|
},
|
|
103
|
-
usage: "dss ml-task train <analysisId> <mlTaskId> [--session-name NAME] [--wait] [--timeout MS] [--poll-interval MS] [--dry-run] [--project-key KEY]",
|
|
104
100
|
description: "Start ML task training, optionally waiting for trained model IDs. --timeout bounds only the wait phase after DSS accepts training; an invalid timeout fails before any request.",
|
|
105
101
|
examples: [
|
|
106
102
|
"dss ml-task train ANALYSIS_ID TASK_ID --session-name baseline --wait --timeout 60000 --project-key PROJECT",
|
|
@@ -109,19 +105,17 @@ export const mlTaskCommands = {
|
|
|
109
105
|
},
|
|
110
106
|
"list-models": {
|
|
111
107
|
handler: (c, a, f) => {
|
|
112
|
-
requireArgs(a, 2, "
|
|
108
|
+
requireArgs(a, 2, commandUsage("ml-task", "list-models"));
|
|
113
109
|
return c.mlTasks.listTrainedModels(a[0], a[1], f["project-key"]);
|
|
114
110
|
},
|
|
115
|
-
usage: "dss ml-task list-models <analysisId> <mlTaskId> [--project-key KEY]",
|
|
116
111
|
description: "List trained models for a Visual ML task.",
|
|
117
112
|
examples: ["dss ml-task list-models ANALYSIS_ID TASK_ID --project-key PROJECT",],
|
|
118
113
|
},
|
|
119
114
|
"model-details": {
|
|
120
115
|
handler: (c, a, f) => {
|
|
121
|
-
requireArgs(a, 3, "
|
|
116
|
+
requireArgs(a, 3, commandUsage("ml-task", "model-details"));
|
|
122
117
|
return c.mlTasks.trainedModelDetails(a[0], a[1], a[2], f["project-key"]);
|
|
123
118
|
},
|
|
124
|
-
usage: "dss ml-task model-details <analysisId> <mlTaskId> <modelId> [--project-key KEY]",
|
|
125
119
|
description: "Get details for one trained model.",
|
|
126
120
|
examples: [
|
|
127
121
|
"dss ml-task model-details ANALYSIS_ID TASK_ID MODEL_ID --project-key PROJECT",
|
|
@@ -129,7 +123,7 @@ export const mlTaskCommands = {
|
|
|
129
123
|
},
|
|
130
124
|
deploy: {
|
|
131
125
|
handler: async (c, a, f) => {
|
|
132
|
-
const usage = "
|
|
126
|
+
const usage = commandUsage("ml-task", "deploy");
|
|
133
127
|
requireArgs(a, 3, usage);
|
|
134
128
|
const options = {
|
|
135
129
|
analysisId: a[0],
|
|
@@ -150,7 +144,6 @@ export const mlTaskCommands = {
|
|
|
150
144
|
}
|
|
151
145
|
return c.mlTasks.deployToFlow(options);
|
|
152
146
|
},
|
|
153
|
-
usage: "dss ml-task deploy <analysisId> <mlTaskId> <modelId> --model-name NAME --train-dataset DATASET [--test-dataset DATASET] [--dry-run] [--project-key KEY]",
|
|
154
147
|
description: "Deploy a trained model to the Flow as a saved model.",
|
|
155
148
|
examples: [
|
|
156
149
|
"dss ml-task deploy ANALYSIS_ID TASK_ID MODEL_ID --model-name churn-model --train-dataset train --test-dataset test --project-key PROJECT",
|
|
@@ -159,7 +152,7 @@ export const mlTaskCommands = {
|
|
|
159
152
|
},
|
|
160
153
|
delete: {
|
|
161
154
|
handler: async (c, a, f) => {
|
|
162
|
-
requireArgs(a, 2, "
|
|
155
|
+
requireArgs(a, 2, commandUsage("ml-task", "delete"));
|
|
163
156
|
const projectKey = f["project-key"];
|
|
164
157
|
if (executionMode(f).dryRun) {
|
|
165
158
|
return {
|
|
@@ -174,11 +167,10 @@ export const mlTaskCommands = {
|
|
|
174
167
|
await c.mlTasks.delete(a[0], a[1], projectKey);
|
|
175
168
|
return { deleted: a[1], resource: "ml-task", analysisId: a[0], };
|
|
176
169
|
},
|
|
177
|
-
usage: "dss ml-task delete <analysisId> <mlTaskId> [--dry-run] [--project-key KEY]",
|
|
178
170
|
description: "Delete a Visual ML task.",
|
|
179
171
|
examples: [
|
|
180
172
|
"dss ml-task delete ANALYSIS_ID TASK_ID --project-key PROJECT",
|
|
181
173
|
"dss ml-task delete ANALYSIS_ID TASK_ID --dry-run --project-key PROJECT",
|
|
182
174
|
],
|
|
183
175
|
},
|
|
184
|
-
};
|
|
176
|
+
});
|
|
@@ -1,26 +1,25 @@
|
|
|
1
1
|
import { requiredStringFlag, } from "../coerce.js";
|
|
2
2
|
import { executionMode, } from "../flags.js";
|
|
3
3
|
import { readIfExists, skipResult, } from "../output.js";
|
|
4
|
+
import { commandUsage, withUsage, } from "../syntax.js";
|
|
4
5
|
import { requireArgs, } from "../usage.js";
|
|
5
|
-
export const modelEvaluationStoreCommands = {
|
|
6
|
+
export const modelEvaluationStoreCommands = withUsage("model-evaluation-store", {
|
|
6
7
|
list: {
|
|
7
8
|
handler: (c, _a, f) => c.modelEvaluationStores.list(f["project-key"]),
|
|
8
|
-
usage: "dss model-evaluation-store list [--project-key KEY]",
|
|
9
9
|
description: "List model evaluation stores in a project.",
|
|
10
10
|
examples: ["dss model-evaluation-store list --project-key PROJECT",],
|
|
11
11
|
},
|
|
12
12
|
get: {
|
|
13
13
|
handler: (c, a, f) => {
|
|
14
|
-
requireArgs(a, 1, "
|
|
14
|
+
requireArgs(a, 1, commandUsage("model-evaluation-store", "get"));
|
|
15
15
|
return c.modelEvaluationStores.get(a[0], f["project-key"]);
|
|
16
16
|
},
|
|
17
|
-
usage: "dss model-evaluation-store get <storeId> [--project-key KEY]",
|
|
18
17
|
description: "Get a model evaluation store.",
|
|
19
18
|
examples: ["dss model-evaluation-store get STORE_ID --project-key PROJECT",],
|
|
20
19
|
},
|
|
21
20
|
create: {
|
|
22
21
|
handler: async (c, _a, f) => {
|
|
23
|
-
const usage = "
|
|
22
|
+
const usage = commandUsage("model-evaluation-store", "create");
|
|
24
23
|
const name = requiredStringFlag(f, "name", usage);
|
|
25
24
|
const projectKey = f["project-key"];
|
|
26
25
|
const options = { name, projectKey, };
|
|
@@ -35,7 +34,6 @@ export const modelEvaluationStoreCommands = {
|
|
|
35
34
|
const created = await c.modelEvaluationStores.create(options);
|
|
36
35
|
return { created: created.id, resource: "model-evaluation-store", ...created, };
|
|
37
36
|
},
|
|
38
|
-
usage: "dss model-evaluation-store create --name NAME [--dry-run] [--project-key KEY]",
|
|
39
37
|
description: "Create an empty model evaluation store.",
|
|
40
38
|
examples: [
|
|
41
39
|
"dss model-evaluation-store create --name production-evaluations --project-key PROJECT",
|
|
@@ -44,10 +42,9 @@ export const modelEvaluationStoreCommands = {
|
|
|
44
42
|
},
|
|
45
43
|
"list-evaluations": {
|
|
46
44
|
handler: (c, a, f) => {
|
|
47
|
-
requireArgs(a, 1, "
|
|
45
|
+
requireArgs(a, 1, commandUsage("model-evaluation-store", "list-evaluations"));
|
|
48
46
|
return c.modelEvaluationStores.listEvaluations(a[0], f["project-key"]);
|
|
49
47
|
},
|
|
50
|
-
usage: "dss model-evaluation-store list-evaluations <storeId> [--project-key KEY]",
|
|
51
48
|
description: "List evaluations in a model evaluation store.",
|
|
52
49
|
examples: [
|
|
53
50
|
"dss model-evaluation-store list-evaluations STORE_ID --project-key PROJECT",
|
|
@@ -55,7 +52,7 @@ export const modelEvaluationStoreCommands = {
|
|
|
55
52
|
},
|
|
56
53
|
delete: {
|
|
57
54
|
handler: async (c, a, f) => {
|
|
58
|
-
requireArgs(a, 1, "
|
|
55
|
+
requireArgs(a, 1, commandUsage("model-evaluation-store", "delete"));
|
|
59
56
|
const projectKey = f["project-key"];
|
|
60
57
|
if (executionMode(f).dryRun || f["if-exists"] === true) {
|
|
61
58
|
const current = await readIfExists(() => c.modelEvaluationStores.get(a[0], projectKey));
|
|
@@ -74,11 +71,10 @@ export const modelEvaluationStoreCommands = {
|
|
|
74
71
|
await c.modelEvaluationStores.delete(a[0], projectKey);
|
|
75
72
|
return { deleted: a[0], resource: "model-evaluation-store", };
|
|
76
73
|
},
|
|
77
|
-
usage: "dss model-evaluation-store delete <storeId> [--if-exists] [--dry-run] [--project-key KEY]",
|
|
78
74
|
description: "Delete a model evaluation store.",
|
|
79
75
|
examples: [
|
|
80
76
|
"dss model-evaluation-store delete STORE_ID --if-exists --project-key PROJECT",
|
|
81
77
|
"dss model-evaluation-store delete STORE_ID --dry-run --project-key PROJECT",
|
|
82
78
|
],
|
|
83
79
|
},
|
|
84
|
-
};
|
|
80
|
+
});
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { jsonInput, num, parseBooleanOption, } from "../coerce.js";
|
|
2
2
|
import { executionMode, } from "../flags.js";
|
|
3
3
|
import { encodedProjectEndpoint, readIfExists, skipResult, } from "../output.js";
|
|
4
|
+
import { commandUsage, withUsage, } from "../syntax.js";
|
|
4
5
|
import { requireArgs, requireNoArgs, UsageError, } from "../usage.js";
|
|
5
|
-
export const notebookCommands = {
|
|
6
|
+
export const notebookCommands = withUsage("notebook", {
|
|
6
7
|
"list-jupyter": {
|
|
7
8
|
handler: (c, _a, f) => c.notebooks.listJupyter(f["project-key"], {
|
|
8
9
|
active: parseBooleanOption(f["active"], "--active"),
|
|
9
10
|
}),
|
|
10
|
-
usage: "dss notebook list-jupyter [--active true|false] [--project-key KEY]",
|
|
11
11
|
description: "List Jupyter notebooks. Pass --active to use the official ?active= filter: true lists currently running notebooks, false lists non-running ones.",
|
|
12
12
|
examples: [
|
|
13
13
|
"dss notebook list-jupyter",
|
|
@@ -16,16 +16,15 @@ export const notebookCommands = {
|
|
|
16
16
|
},
|
|
17
17
|
"get-jupyter": {
|
|
18
18
|
handler: (c, a, f) => {
|
|
19
|
-
requireArgs(a, 1, "
|
|
19
|
+
requireArgs(a, 1, commandUsage("notebook", "get-jupyter"));
|
|
20
20
|
return c.notebooks.getJupyter(a[0], f["project-key"]);
|
|
21
21
|
},
|
|
22
|
-
usage: "dss notebook get-jupyter <name> [--project-key KEY]",
|
|
23
22
|
description: "Get a Jupyter notebook.",
|
|
24
23
|
examples: ["dss notebook get-jupyter my_notebook",],
|
|
25
24
|
},
|
|
26
25
|
"delete-jupyter": {
|
|
27
26
|
handler: async (c, a, f) => {
|
|
28
|
-
requireArgs(a, 1, "
|
|
27
|
+
requireArgs(a, 1, commandUsage("notebook", "delete-jupyter"));
|
|
29
28
|
const pk = f["project-key"];
|
|
30
29
|
if (executionMode(f).dryRun || f["if-exists"] === true) {
|
|
31
30
|
const current = await readIfExists(() => c.notebooks.getJupyter(a[0], pk));
|
|
@@ -38,13 +37,12 @@ export const notebookCommands = {
|
|
|
38
37
|
await c.notebooks.deleteJupyter(a[0], pk);
|
|
39
38
|
return { deleted: a[0], resource: "jupyter-notebook", };
|
|
40
39
|
},
|
|
41
|
-
usage: "dss notebook delete-jupyter <name> [--if-exists] [--dry-run] [--project-key KEY]",
|
|
42
40
|
description: "Delete a Jupyter notebook.",
|
|
43
41
|
examples: ["dss notebook delete-jupyter my_notebook --dry-run",],
|
|
44
42
|
},
|
|
45
43
|
"clear-jupyter-outputs": {
|
|
46
44
|
handler: async (c, a, f) => {
|
|
47
|
-
requireArgs(a, 1, "
|
|
45
|
+
requireArgs(a, 1, commandUsage("notebook", "clear-jupyter-outputs"));
|
|
48
46
|
const pk = f["project-key"];
|
|
49
47
|
if (executionMode(f).dryRun) {
|
|
50
48
|
// The real mutation is a single server-side DELETE of the
|
|
@@ -65,16 +63,14 @@ export const notebookCommands = {
|
|
|
65
63
|
await c.notebooks.clearJupyterOutputs(a[0], pk);
|
|
66
64
|
return { cleared: a[0], resource: "jupyter-notebook", };
|
|
67
65
|
},
|
|
68
|
-
usage: "dss notebook clear-jupyter-outputs <name> [--dry-run] [--project-key KEY]",
|
|
69
66
|
description: "Clear all cell outputs from a Jupyter notebook.",
|
|
70
67
|
examples: ["dss notebook clear-jupyter-outputs my_notebook --dry-run",],
|
|
71
68
|
},
|
|
72
69
|
"sessions-jupyter": {
|
|
73
70
|
handler: (c, a, f) => {
|
|
74
|
-
requireArgs(a, 1, "
|
|
71
|
+
requireArgs(a, 1, commandUsage("notebook", "sessions-jupyter"));
|
|
75
72
|
return c.notebooks.listJupyterSessions(a[0], f["project-key"]);
|
|
76
73
|
},
|
|
77
|
-
usage: "dss notebook sessions-jupyter <name> [--project-key KEY]",
|
|
78
74
|
description: "List active kernel sessions for a Jupyter notebook.",
|
|
79
75
|
examples: ["dss notebook sessions-jupyter my_notebook",],
|
|
80
76
|
},
|
|
@@ -82,7 +78,7 @@ export const notebookCommands = {
|
|
|
82
78
|
handler: async (c, a, f) => {
|
|
83
79
|
const pk = f["project-key"];
|
|
84
80
|
if (f["all"] === true) {
|
|
85
|
-
requireNoArgs(a, "
|
|
81
|
+
requireNoArgs(a, commandUsage("notebook", "unload-jupyter"));
|
|
86
82
|
if (executionMode(f).dryRun) {
|
|
87
83
|
const planned = [];
|
|
88
84
|
for (const notebook of await c.notebooks.listJupyter(pk, { active: true, })) {
|
|
@@ -106,7 +102,7 @@ export const notebookCommands = {
|
|
|
106
102
|
const unloaded = await c.notebooks.unloadJupyterAll(pk);
|
|
107
103
|
return { unloaded, resource: "jupyter-notebook", all: true, };
|
|
108
104
|
}
|
|
109
|
-
requireArgs(a, 2, "
|
|
105
|
+
requireArgs(a, 2, commandUsage("notebook", "unload-jupyter"));
|
|
110
106
|
if (executionMode(f).dryRun) {
|
|
111
107
|
const sessions = await c.notebooks.listJupyterSessions(a[0], pk);
|
|
112
108
|
const current = sessions.find((session) => session.sessionId === a[1]);
|
|
@@ -124,7 +120,6 @@ export const notebookCommands = {
|
|
|
124
120
|
await c.notebooks.unloadJupyter(a[0], a[1], pk);
|
|
125
121
|
return { unloaded: a[0], sessionId: a[1], resource: "jupyter-notebook", };
|
|
126
122
|
},
|
|
127
|
-
usage: "dss notebook unload-jupyter (<name> <sessionId>|--all) [--dry-run] [--project-key KEY]",
|
|
128
123
|
description: "Unload a Jupyter notebook kernel session, or every session of every running notebook with --all.",
|
|
129
124
|
examples: [
|
|
130
125
|
"dss notebook unload-jupyter my_notebook SESSION_ID --dry-run",
|
|
@@ -133,22 +128,20 @@ export const notebookCommands = {
|
|
|
133
128
|
},
|
|
134
129
|
"list-sql": {
|
|
135
130
|
handler: (c, _a, f) => c.notebooks.listSql(f["project-key"]),
|
|
136
|
-
usage: "dss notebook list-sql [--project-key KEY]",
|
|
137
131
|
description: "List SQL notebooks.",
|
|
138
132
|
examples: ["dss notebook list-sql",],
|
|
139
133
|
},
|
|
140
134
|
"get-sql": {
|
|
141
135
|
handler: (c, a, f) => {
|
|
142
|
-
requireArgs(a, 1, "
|
|
136
|
+
requireArgs(a, 1, commandUsage("notebook", "get-sql"));
|
|
143
137
|
return c.notebooks.getSql(a[0], f["project-key"]);
|
|
144
138
|
},
|
|
145
|
-
usage: "dss notebook get-sql <id> [--project-key KEY]",
|
|
146
139
|
description: "Get a SQL notebook.",
|
|
147
140
|
examples: ["dss notebook get-sql my_sql_notebook",],
|
|
148
141
|
},
|
|
149
142
|
"delete-sql": {
|
|
150
143
|
handler: async (c, a, f) => {
|
|
151
|
-
requireArgs(a, 1, "
|
|
144
|
+
requireArgs(a, 1, commandUsage("notebook", "delete-sql"));
|
|
152
145
|
const pk = f["project-key"];
|
|
153
146
|
if (executionMode(f).dryRun || f["if-exists"] === true) {
|
|
154
147
|
const current = await readIfExists(() => c.notebooks.getSql(a[0], pk));
|
|
@@ -161,22 +154,20 @@ export const notebookCommands = {
|
|
|
161
154
|
await c.notebooks.deleteSql(a[0], pk);
|
|
162
155
|
return { deleted: a[0], resource: "sql-notebook", };
|
|
163
156
|
},
|
|
164
|
-
usage: "dss notebook delete-sql <id> [--if-exists] [--dry-run] [--project-key KEY]",
|
|
165
157
|
description: "Delete a SQL notebook.",
|
|
166
158
|
examples: ["dss notebook delete-sql my_sql_notebook --dry-run",],
|
|
167
159
|
},
|
|
168
160
|
"history-sql": {
|
|
169
161
|
handler: (c, a, f) => {
|
|
170
|
-
requireArgs(a, 1, "
|
|
162
|
+
requireArgs(a, 1, commandUsage("notebook", "history-sql"));
|
|
171
163
|
return c.notebooks.getSqlHistory(a[0], f["project-key"]);
|
|
172
164
|
},
|
|
173
|
-
usage: "dss notebook history-sql <id> [--project-key KEY]",
|
|
174
165
|
description: "Get query history for a SQL notebook.",
|
|
175
166
|
examples: ["dss notebook history-sql my_sql_notebook",],
|
|
176
167
|
},
|
|
177
168
|
"save-jupyter": {
|
|
178
169
|
handler: async (c, a, f) => {
|
|
179
|
-
requireArgs(a, 1, "
|
|
170
|
+
requireArgs(a, 1, commandUsage("notebook", "save-jupyter"));
|
|
180
171
|
const data = jsonInput(f);
|
|
181
172
|
if (!data) {
|
|
182
173
|
throw new UsageError("--data, --data-file, or --stdin is required (notebook JSON content).");
|
|
@@ -203,7 +194,6 @@ export const notebookCommands = {
|
|
|
203
194
|
hash: result.hash,
|
|
204
195
|
};
|
|
205
196
|
},
|
|
206
|
-
usage: "dss notebook save-jupyter <name> (--data '{...}' | --data-file PATH | --stdin) [--expect-hash SHA256] [--dry-run] [--project-key KEY]",
|
|
207
197
|
description: "Save content to a Jupyter notebook, creating it if missing. Reports created versus updated and the persisted content hash; --expect-hash aborts with a stale-read error when the stored content hash changed.",
|
|
208
198
|
examples: [
|
|
209
199
|
"dss notebook save-jupyter my_notebook --data-file notebook.json --dry-run",
|
|
@@ -212,7 +202,7 @@ export const notebookCommands = {
|
|
|
212
202
|
},
|
|
213
203
|
"save-sql": {
|
|
214
204
|
handler: async (c, a, f) => {
|
|
215
|
-
requireArgs(a, 1, "
|
|
205
|
+
requireArgs(a, 1, commandUsage("notebook", "save-sql"));
|
|
216
206
|
const data = jsonInput(f);
|
|
217
207
|
if (!data) {
|
|
218
208
|
throw new UsageError("--data, --data-file, or --stdin is required (SQL notebook content JSON).");
|
|
@@ -243,13 +233,12 @@ export const notebookCommands = {
|
|
|
243
233
|
hash: result.hash,
|
|
244
234
|
};
|
|
245
235
|
},
|
|
246
|
-
usage: "dss notebook save-sql <id> (--data '{...}' | --data-file PATH | --stdin) [--expect-hash SHA256] [--dry-run] [--project-key KEY]",
|
|
247
236
|
description: "Save content to a SQL notebook, creating it if missing. On create DSS allocates the notebook id: `saved` is the persisted id to use for every later read/update/delete, and `requested` echoes the handle, which becomes the display name. Reports created versus updated and the persisted content hash; --expect-hash rejects a stale read before writing and refuses a missing notebook.",
|
|
248
237
|
examples: ["dss notebook save-sql my_sql_notebook --data-file content.json --dry-run",],
|
|
249
238
|
},
|
|
250
239
|
"clear-sql-history": {
|
|
251
240
|
handler: async (c, a, f) => {
|
|
252
|
-
requireArgs(a, 1, "
|
|
241
|
+
requireArgs(a, 1, commandUsage("notebook", "clear-sql-history"));
|
|
253
242
|
const pk = f["project-key"];
|
|
254
243
|
const options = {
|
|
255
244
|
cellId: f["cell-id"],
|
|
@@ -272,11 +261,10 @@ export const notebookCommands = {
|
|
|
272
261
|
await c.notebooks.clearSqlHistory(a[0], options);
|
|
273
262
|
return { cleared: a[0], resource: "sql-notebook", };
|
|
274
263
|
},
|
|
275
|
-
usage: "dss notebook clear-sql-history <id> [--cell-id CID] [--retain N] [--dry-run] [--project-key KEY]",
|
|
276
264
|
description: "Clear query history for a SQL notebook.",
|
|
277
265
|
examples: [
|
|
278
266
|
"dss notebook clear-sql-history my_sql_notebook --dry-run",
|
|
279
267
|
"dss notebook clear-sql-history my_sql_notebook --cell-id CELL1 --retain 5",
|
|
280
268
|
],
|
|
281
269
|
},
|
|
282
|
-
};
|
|
270
|
+
});
|