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,4 +1,3 @@
|
|
|
1
|
-
import { buildDatasetCloneSettings, } from "../../resources/datasets.js";
|
|
2
1
|
import { deepMerge, } from "../../utils/deep-merge.js";
|
|
3
2
|
import { compareStrings, stableHash, } from "../../utils/stable-hash.js";
|
|
4
3
|
import { jsonInput, num, schemaColumnsInput, unknownJsonInput, } from "../coerce.js";
|
|
@@ -6,6 +5,7 @@ import { executionMode, } from "../flags.js";
|
|
|
6
5
|
import { datasetSourceSummary, } from "../helpers/dataset.js";
|
|
7
6
|
import { moveCreatedItemsToZone, resolveFlowZoneIdFromFlags, } from "../helpers/flow-zone.js";
|
|
8
7
|
import { enqueueCliWarning, readIfExists, skipResult, } from "../output.js";
|
|
8
|
+
import { commandUsage, withUsage, } from "../syntax.js";
|
|
9
9
|
import { requireArgs, UsageError, } from "../usage.js";
|
|
10
10
|
const MAX_SCHEMA_DIFFERENCES = 50;
|
|
11
11
|
function isPlainObject(value) {
|
|
@@ -98,82 +98,74 @@ export function compareDatasetSchemas(expected, actual) {
|
|
|
98
98
|
differencesTruncated: acc.items.length < acc.total,
|
|
99
99
|
};
|
|
100
100
|
}
|
|
101
|
-
export const datasetCommands = {
|
|
101
|
+
export const datasetCommands = withUsage("dataset", {
|
|
102
102
|
list: {
|
|
103
103
|
handler: (c, _a, f) => c.datasets.list(f["project-key"]),
|
|
104
|
-
usage: "dss dataset list [--project-key KEY]",
|
|
105
104
|
description: "List all datasets in a project.",
|
|
106
105
|
examples: ["dss dataset list", "dss dataset list --project-key MYPROJ",],
|
|
107
106
|
},
|
|
108
107
|
rename: {
|
|
109
108
|
handler: async (c, a, f) => {
|
|
110
|
-
requireArgs(a, 2, "
|
|
109
|
+
requireArgs(a, 2, commandUsage("dataset", "rename"));
|
|
111
110
|
await c.datasets.rename(a[0], a[1], f["project-key"]);
|
|
112
111
|
return { renamed: a[0], to: a[1], };
|
|
113
112
|
},
|
|
114
|
-
usage: "dss dataset rename <oldName> <newName> [--project-key KEY]",
|
|
115
113
|
description: "Rename a dataset (updates downstream flow references).",
|
|
116
114
|
examples: ["dss dataset rename old_ds new_ds",],
|
|
117
115
|
},
|
|
118
116
|
"list-partitions": {
|
|
119
117
|
handler: (c, a, f) => {
|
|
120
|
-
requireArgs(a, 1, "
|
|
118
|
+
requireArgs(a, 1, commandUsage("dataset", "list-partitions"));
|
|
121
119
|
return c.datasets.listPartitions(a[0], f["project-key"]);
|
|
122
120
|
},
|
|
123
|
-
usage: "dss dataset list-partitions <name> [--project-key KEY]",
|
|
124
121
|
description: "List the partitions of a partitioned dataset.",
|
|
125
122
|
examples: ["dss dataset list-partitions events",],
|
|
126
123
|
},
|
|
127
124
|
clear: {
|
|
128
125
|
handler: async (c, a, f) => {
|
|
129
|
-
requireArgs(a, 1, "
|
|
126
|
+
requireArgs(a, 1, commandUsage("dataset", "clear"));
|
|
130
127
|
const partitions = f["partitions"];
|
|
131
128
|
await c.datasets.clear(a[0], partitions, f["project-key"]);
|
|
132
129
|
return { cleared: a[0], partitions: partitions ?? "ALL", };
|
|
133
130
|
},
|
|
134
|
-
usage: "dss dataset clear <name> [--partitions SPEC] [--project-key KEY]",
|
|
135
131
|
description: "Clear a dataset's data (all, or a partition spec); keeps the dataset.",
|
|
136
132
|
examples: ["dss dataset clear staging", "dss dataset clear events --partitions 2024-01",],
|
|
137
133
|
},
|
|
138
134
|
get: {
|
|
139
135
|
handler: (c, a, f) => {
|
|
140
|
-
requireArgs(a, 1, "
|
|
136
|
+
requireArgs(a, 1, commandUsage("dataset", "get"));
|
|
141
137
|
return c.datasets.get(a[0], f["project-key"]);
|
|
142
138
|
},
|
|
143
|
-
usage: "dss dataset get <name> [--project-key KEY]",
|
|
144
139
|
description: "Get full settings for a dataset.",
|
|
145
140
|
examples: ["dss dataset get orders", "dss dataset get orders --project-key MYPROJ",],
|
|
146
141
|
},
|
|
147
142
|
schema: {
|
|
148
143
|
handler: (c, a, f) => {
|
|
149
|
-
requireArgs(a, 1, "
|
|
144
|
+
requireArgs(a, 1, commandUsage("dataset", "schema"));
|
|
150
145
|
return c.datasets.schema(a[0], f["project-key"]);
|
|
151
146
|
},
|
|
152
|
-
usage: "dss dataset schema <name> [--project-key KEY]",
|
|
153
147
|
description: "Show the column schema of a dataset.",
|
|
154
148
|
examples: ["dss dataset schema orders",],
|
|
155
149
|
},
|
|
156
150
|
source: {
|
|
157
151
|
handler: async (c, a, f) => {
|
|
158
|
-
requireArgs(a, 1, "
|
|
152
|
+
requireArgs(a, 1, commandUsage("dataset", "source"));
|
|
159
153
|
return datasetSourceSummary(await c.datasets.get(a[0], f["project-key"]));
|
|
160
154
|
},
|
|
161
|
-
usage: "dss dataset source <name> [--project-key KEY]",
|
|
162
155
|
description: "Show backing connection, catalog/schema/table, path, and format for a dataset.",
|
|
163
156
|
examples: ["dss dataset source orders",],
|
|
164
157
|
},
|
|
165
158
|
files: {
|
|
166
159
|
handler: (c, a, f) => {
|
|
167
|
-
requireArgs(a, 1, "
|
|
160
|
+
requireArgs(a, 1, commandUsage("dataset", "files"));
|
|
168
161
|
return c.datasets.listUploadedFiles(a[0], f["project-key"]);
|
|
169
162
|
},
|
|
170
|
-
usage: "dss dataset files <name> [--project-key KEY]",
|
|
171
163
|
description: "List files stored by an UploadedFiles dataset.",
|
|
172
164
|
examples: ["dss dataset files uploaded_input",],
|
|
173
165
|
},
|
|
174
166
|
"upload-file": {
|
|
175
167
|
handler: (c, a, f) => {
|
|
176
|
-
const usage = "
|
|
168
|
+
const usage = commandUsage("dataset", "upload-file");
|
|
177
169
|
requireArgs(a, 2, usage);
|
|
178
170
|
const fileName = f["file-name"];
|
|
179
171
|
if (!fileName || fileName.trim() === "") {
|
|
@@ -184,7 +176,6 @@ export const datasetCommands = {
|
|
|
184
176
|
projectKey: f["project-key"],
|
|
185
177
|
});
|
|
186
178
|
},
|
|
187
|
-
usage: "dss dataset upload-file <name> <localPath> --file-name NAME [--project-key KEY]",
|
|
188
179
|
description: "Add one new file to an UploadedFiles dataset and verify the stored byte length.",
|
|
189
180
|
examples: [
|
|
190
181
|
"dss dataset upload-file uploaded_input ./input.csv --file-name input.csv",
|
|
@@ -192,7 +183,7 @@ export const datasetCommands = {
|
|
|
192
183
|
},
|
|
193
184
|
"refresh-schema": {
|
|
194
185
|
handler: async (c, a, f) => {
|
|
195
|
-
const usage = "
|
|
186
|
+
const usage = commandUsage("dataset", "refresh-schema");
|
|
196
187
|
requireArgs(a, 1, usage);
|
|
197
188
|
const columns = schemaColumnsInput(f, usage);
|
|
198
189
|
const pk = f["project-key"];
|
|
@@ -210,7 +201,6 @@ export const datasetCommands = {
|
|
|
210
201
|
await c.datasets.updateSchema(a[0], columns, pk);
|
|
211
202
|
return { updated: a[0], resource: "dataset", schema: { columns, }, };
|
|
212
203
|
},
|
|
213
|
-
usage: "dss dataset refresh-schema <name> (--data JSON | --data-file PATH | --stdin) [--dry-run] [--project-key KEY]",
|
|
214
204
|
description: "Replace a dataset schema through the DSS schema endpoint.",
|
|
215
205
|
examples: [
|
|
216
206
|
`dss dataset refresh-schema orders --data '{"columns":[{"name":"id","type":"bigint"}]}' --dry-run`,
|
|
@@ -218,16 +208,15 @@ export const datasetCommands = {
|
|
|
218
208
|
},
|
|
219
209
|
"validate-build": {
|
|
220
210
|
handler: (c, a, f) => {
|
|
221
|
-
requireArgs(a, 1, "
|
|
211
|
+
requireArgs(a, 1, commandUsage("dataset", "validate-build"));
|
|
222
212
|
return c.datasets.validateBuildSettings(a[0], f["project-key"]);
|
|
223
213
|
},
|
|
224
|
-
usage: "dss dataset validate-build <name> [--project-key KEY]",
|
|
225
214
|
description: "Check common dataset settings that can make file-backed builds fail.",
|
|
226
215
|
examples: ["dss dataset validate-build orders",],
|
|
227
216
|
},
|
|
228
217
|
preview: {
|
|
229
218
|
handler: async (c, a, f) => {
|
|
230
|
-
const previewUsage = "
|
|
219
|
+
const previewUsage = commandUsage("dataset", "preview");
|
|
231
220
|
requireArgs(a, 1, previewUsage);
|
|
232
221
|
const maxRows = num(f["max-rows"], "--max-rows");
|
|
233
222
|
if (maxRows !== undefined && (!Number.isSafeInteger(maxRows) || maxRows <= 0 || maxRows > 500)) {
|
|
@@ -252,13 +241,12 @@ export const datasetCommands = {
|
|
|
252
241
|
}
|
|
253
242
|
return result;
|
|
254
243
|
},
|
|
255
|
-
usage: "dss dataset preview <name> [--max-rows N] [--rows N] [--project-key KEY] [--timeout MS]",
|
|
256
244
|
description: "Preview dataset rows (--rows is an alias for --max-rows). Returns { columns, rows, rowCount, truncated, limit }; when the dataset has more rows than the cap, truncated is true and a dataset_preview_truncated warning is written to stderr.",
|
|
257
245
|
examples: ["dss dataset preview orders", "dss dataset preview orders --rows 5",],
|
|
258
246
|
},
|
|
259
247
|
"assert-count": {
|
|
260
248
|
handler: async (c, a, f) => {
|
|
261
|
-
const assertUsage = "
|
|
249
|
+
const assertUsage = commandUsage("dataset", "assert-count");
|
|
262
250
|
requireArgs(a, 1, assertUsage);
|
|
263
251
|
const expected = num(f["expected"], "--expected");
|
|
264
252
|
if (expected === undefined || !Number.isSafeInteger(expected) || expected < 0) {
|
|
@@ -268,13 +256,12 @@ export const datasetCommands = {
|
|
|
268
256
|
const result = await c.datasets.assertRowCount(a[0], expected, f["project-key"]);
|
|
269
257
|
return { ...result, dataset: a[0], };
|
|
270
258
|
},
|
|
271
|
-
usage: "dss dataset assert-count <dataset> --expected N [--project-key KEY]",
|
|
272
259
|
description: "Stream the dataset and assert it holds exactly --expected rows, probing at most N+1 rows. Returns { satisfied, expected, count, exact }; a mismatch exits 4 with assertion_failed.",
|
|
273
260
|
examples: ["dss dataset assert-count orders --expected 1000",],
|
|
274
261
|
},
|
|
275
262
|
"assert-schema": {
|
|
276
263
|
handler: async (c, a, f) => {
|
|
277
|
-
const assertUsage = "
|
|
264
|
+
const assertUsage = commandUsage("dataset", "assert-schema");
|
|
278
265
|
requireArgs(a, 1, assertUsage);
|
|
279
266
|
const expected = unknownJsonInput(f);
|
|
280
267
|
if (expected === undefined) {
|
|
@@ -292,7 +279,6 @@ export const datasetCommands = {
|
|
|
292
279
|
differences: comparison.differences,
|
|
293
280
|
};
|
|
294
281
|
},
|
|
295
|
-
usage: "dss dataset assert-schema <dataset> (--data JSON | --data-file PATH | --stdin) [--project-key KEY]",
|
|
296
282
|
description: "Assert the dataset's full schema equals the expected schema object; reports concise per-path differences with sha256 subtree hashes. A mismatch exits 4 with assertion_failed.",
|
|
297
283
|
examples: [
|
|
298
284
|
`dss dataset assert-schema orders --data-file expected-schema.json`,
|
|
@@ -301,16 +287,15 @@ export const datasetCommands = {
|
|
|
301
287
|
},
|
|
302
288
|
metadata: {
|
|
303
289
|
handler: (c, a, f) => {
|
|
304
|
-
requireArgs(a, 1, "
|
|
290
|
+
requireArgs(a, 1, commandUsage("dataset", "metadata"));
|
|
305
291
|
return c.datasets.metadata(a[0], f["project-key"]);
|
|
306
292
|
},
|
|
307
|
-
usage: "dss dataset metadata <name> [--project-key KEY]",
|
|
308
293
|
description: "Get dataset-level metadata.",
|
|
309
294
|
examples: ["dss dataset metadata orders",],
|
|
310
295
|
},
|
|
311
296
|
"metadata-set": {
|
|
312
297
|
handler: async (c, a, f) => {
|
|
313
|
-
const usage = "
|
|
298
|
+
const usage = commandUsage("dataset", "metadata-set");
|
|
314
299
|
requireArgs(a, 1, usage);
|
|
315
300
|
// Validated identically for live, --plan, and --dry-run: the JSON
|
|
316
301
|
// input replaces the server metadata object verbatim (faithful PUT;
|
|
@@ -335,7 +320,6 @@ export const datasetCommands = {
|
|
|
335
320
|
const updated = await c.datasets.updateMetadata(a[0], metadata, pk);
|
|
336
321
|
return { updated: a[0], resource: "dataset", metadata: updated, };
|
|
337
322
|
},
|
|
338
|
-
usage: "dss dataset metadata-set <name> (--data JSON | --data-file PATH | --stdin) [--dry-run] [--project-key KEY]",
|
|
339
323
|
description: "Replace dataset-level metadata with the given JSON object (faithful PUT: GET, edit, PUT full object; no merge).",
|
|
340
324
|
examples: [
|
|
341
325
|
`dss dataset metadata-set orders --data '{"label":"Orders","tags":["prod"]}' --dry-run`,
|
|
@@ -349,7 +333,7 @@ export const datasetCommands = {
|
|
|
349
333
|
const connection = f["connection"];
|
|
350
334
|
const dsType = f["type"];
|
|
351
335
|
if (!name || !dsType) {
|
|
352
|
-
throw new UsageError(
|
|
336
|
+
throw new UsageError(`--name and --type are required. Usage: ${commandUsage("dataset", "create")}`);
|
|
353
337
|
}
|
|
354
338
|
if (!connection && dsType.toLowerCase() !== "uploadedfiles") {
|
|
355
339
|
throw new UsageError("--connection is required unless --type is UploadedFiles.");
|
|
@@ -383,7 +367,6 @@ export const datasetCommands = {
|
|
|
383
367
|
const moved = await moveCreatedItemsToZone(c, f, [{ objectId: name, objectType: "DATASET", },], pk);
|
|
384
368
|
return { created: name, resource: "dataset", ...moved, };
|
|
385
369
|
},
|
|
386
|
-
usage: "dss dataset create --name NAME --type TYPE [--connection CONN] [--zone ZONE|--zone-id ID] [--if-not-exists] [--dry-run] [--project-key KEY]",
|
|
387
370
|
description: "Create a new dataset. UploadedFiles uses the server's default upload connection when omitted.",
|
|
388
371
|
examples: [
|
|
389
372
|
"dss dataset create --name uploads --type UploadedFiles",
|
|
@@ -393,7 +376,7 @@ export const datasetCommands = {
|
|
|
393
376
|
},
|
|
394
377
|
"create-managed": {
|
|
395
378
|
handler: async (c, _a, f) => {
|
|
396
|
-
const usage = "
|
|
379
|
+
const usage = commandUsage("dataset", "create-managed");
|
|
397
380
|
const name = f["name"];
|
|
398
381
|
if (!name || name.trim() === "") {
|
|
399
382
|
throw new UsageError(`--name is required. Usage: ${usage}`);
|
|
@@ -447,7 +430,6 @@ export const datasetCommands = {
|
|
|
447
430
|
creationSettings: created.creationSettings,
|
|
448
431
|
};
|
|
449
432
|
},
|
|
450
|
-
usage: "dss dataset create-managed --name NAME --connection CONN [--type-option-id ID] [--format-option-id ID] [--copy-partitioning-from REF] [--partitioning-folder] [--dry-run] [--project-key KEY]",
|
|
451
433
|
description: "Create a managed dataset via the dedicated endpoint: DSS derives storage/format details; you pick name, connection, and optional type/format/partitioning options.",
|
|
452
434
|
examples: [
|
|
453
435
|
"dss dataset create-managed --name orders_copy --connection filesystem_managed",
|
|
@@ -457,16 +439,15 @@ export const datasetCommands = {
|
|
|
457
439
|
},
|
|
458
440
|
info: {
|
|
459
441
|
handler: (c, a, f) => {
|
|
460
|
-
requireArgs(a, 1, "
|
|
442
|
+
requireArgs(a, 1, commandUsage("dataset", "info"));
|
|
461
443
|
return c.datasets.info(a[0], f["project-key"]);
|
|
462
444
|
},
|
|
463
|
-
usage: "dss dataset info <name> [--project-key KEY]",
|
|
464
445
|
description: "Get the full info object for a dataset (type, parameters, last build information, schema, etc.).",
|
|
465
446
|
examples: ["dss dataset info orders", "dss dataset info orders --project-key MYPROJ",],
|
|
466
447
|
},
|
|
467
448
|
"column-lineage": {
|
|
468
449
|
handler: (c, a, f) => {
|
|
469
|
-
const usage = "
|
|
450
|
+
const usage = commandUsage("dataset", "column-lineage");
|
|
470
451
|
requireArgs(a, 2, usage);
|
|
471
452
|
const maxDatasetCount = num(f["max-dataset-count"], "--max-dataset-count");
|
|
472
453
|
if (maxDatasetCount !== undefined
|
|
@@ -479,7 +460,6 @@ export const datasetCommands = {
|
|
|
479
460
|
projectKey: f["project-key"],
|
|
480
461
|
});
|
|
481
462
|
},
|
|
482
|
-
usage: "dss dataset column-lineage <name> <column> [--max-dataset-count N] [--project-key KEY]",
|
|
483
463
|
description: "Get the full column lineage (auto-computed and manual) of a column; includes local and foreign project relations.",
|
|
484
464
|
examples: [
|
|
485
465
|
"dss dataset column-lineage orders customer_id",
|
|
@@ -488,7 +468,7 @@ export const datasetCommands = {
|
|
|
488
468
|
},
|
|
489
469
|
download: {
|
|
490
470
|
handler: async (c, a, f) => {
|
|
491
|
-
requireArgs(a, 1, "
|
|
471
|
+
requireArgs(a, 1, commandUsage("dataset", "download"));
|
|
492
472
|
const result = await c.datasets.download(a[0], {
|
|
493
473
|
outputPath: f["output"],
|
|
494
474
|
projectKey: f["project-key"],
|
|
@@ -517,7 +497,6 @@ export const datasetCommands = {
|
|
|
517
497
|
}
|
|
518
498
|
return result;
|
|
519
499
|
},
|
|
520
|
-
usage: "dss dataset download <name> [--output PATH] [--limit N] [--raw-data] [--project-key KEY]",
|
|
521
500
|
description: "Download up to --limit rows (default 100k) as CSV and return { path, rows, truncated, limit }. Formula-like cells are neutralized for spreadsheets; --raw-data preserves exact bytes. Warnings report truncation and the default output path.",
|
|
522
501
|
examples: [
|
|
523
502
|
"dss dataset download orders",
|
|
@@ -527,7 +506,7 @@ export const datasetCommands = {
|
|
|
527
506
|
},
|
|
528
507
|
clone: {
|
|
529
508
|
handler: async (c, a, f) => {
|
|
530
|
-
const usage = "
|
|
509
|
+
const usage = commandUsage("dataset", "clone");
|
|
531
510
|
requireArgs(a, 2, usage);
|
|
532
511
|
const pk = f["project-key"];
|
|
533
512
|
const opts = {
|
|
@@ -538,6 +517,7 @@ export const datasetCommands = {
|
|
|
538
517
|
allowSamePath: f["allow-same-path"] === true,
|
|
539
518
|
};
|
|
540
519
|
const current = await c.datasets.get(a[0], pk);
|
|
520
|
+
const { buildDatasetCloneSettings, } = await import("../../resources/datasets.js");
|
|
541
521
|
const next = buildDatasetCloneSettings(current, a[1], pk ?? c.resolveProjectKey(pk), opts);
|
|
542
522
|
const zoneId = await resolveFlowZoneIdFromFlags(c, f, pk);
|
|
543
523
|
if (executionMode(f).dryRun) {
|
|
@@ -556,7 +536,6 @@ export const datasetCommands = {
|
|
|
556
536
|
const moved = await moveCreatedItemsToZone(c, f, [{ objectId: a[1], objectType: "DATASET", },], pk);
|
|
557
537
|
return { ...cloned, resource: "dataset", ...moved, };
|
|
558
538
|
},
|
|
559
|
-
usage: "dss dataset clone <source> <target> [--path PATH] [--table TABLE] [--metastore-table TABLE] [--allow-same-path] [--zone ZONE|--zone-id ID] [--dry-run] [--project-key KEY]",
|
|
560
539
|
description: "Clone dataset settings into a new dataset, with storage/table overrides.",
|
|
561
540
|
examples: [
|
|
562
541
|
"dss dataset clone source_ds experiment_ds --path /dataiku/TEST/experiment_ds --dry-run",
|
|
@@ -565,7 +544,7 @@ export const datasetCommands = {
|
|
|
565
544
|
},
|
|
566
545
|
delete: {
|
|
567
546
|
handler: async (c, a, f) => {
|
|
568
|
-
requireArgs(a, 1, "
|
|
547
|
+
requireArgs(a, 1, commandUsage("dataset", "delete"));
|
|
569
548
|
const pk = f["project-key"];
|
|
570
549
|
if (executionMode(f).dryRun || f["if-exists"] === true) {
|
|
571
550
|
const current = await readIfExists(() => c.datasets.get(a[0], pk));
|
|
@@ -578,16 +557,15 @@ export const datasetCommands = {
|
|
|
578
557
|
await c.datasets.delete(a[0], pk);
|
|
579
558
|
return { deleted: a[0], resource: "dataset", };
|
|
580
559
|
},
|
|
581
|
-
usage: "dss dataset delete <name> [--if-exists] [--dry-run] [--project-key KEY]",
|
|
582
560
|
description: "Delete a dataset.",
|
|
583
561
|
examples: ["dss dataset delete orders", "dss dataset delete orders --if-exists",],
|
|
584
562
|
},
|
|
585
563
|
update: {
|
|
586
564
|
handler: async (c, a, f) => {
|
|
587
|
-
requireArgs(a, 1, "
|
|
565
|
+
requireArgs(a, 1, commandUsage("dataset", "update"));
|
|
588
566
|
const data = jsonInput(f);
|
|
589
567
|
if (!data) {
|
|
590
|
-
throw new UsageError(
|
|
568
|
+
throw new UsageError(`--data, --data-file, or --stdin is required. Usage: ${commandUsage("dataset", "update")}`);
|
|
591
569
|
}
|
|
592
570
|
const pk = f["project-key"];
|
|
593
571
|
if (executionMode(f).dryRun) {
|
|
@@ -598,11 +576,10 @@ export const datasetCommands = {
|
|
|
598
576
|
await c.datasets.update(a[0], data, pk);
|
|
599
577
|
return { updated: a[0], resource: "dataset", };
|
|
600
578
|
},
|
|
601
|
-
usage: "dss dataset update <name> (--data '{...}' | --data-file PATH | --stdin) [--dry-run] [--project-key KEY]",
|
|
602
579
|
description: "Update dataset settings via JSON merge.",
|
|
603
580
|
examples: [
|
|
604
581
|
'dss dataset update orders --data \'{"tags":["production"]}\' --dry-run',
|
|
605
582
|
"echo '{\"tags\":[]}' | dss dataset update orders --stdin",
|
|
606
583
|
],
|
|
607
584
|
},
|
|
608
|
-
};
|
|
585
|
+
});
|
|
@@ -1,26 +1,25 @@
|
|
|
1
|
+
import { commandUsage, withUsage, } from "../syntax.js";
|
|
1
2
|
import { requireArgs, UsageError, } from "../usage.js";
|
|
2
|
-
export const discussionCommands = {
|
|
3
|
+
export const discussionCommands = withUsage("discussion", {
|
|
3
4
|
list: {
|
|
4
5
|
handler: (c, a, f) => {
|
|
5
|
-
requireArgs(a, 2, "
|
|
6
|
+
requireArgs(a, 2, commandUsage("discussion", "list"));
|
|
6
7
|
return c.discussions.list(a[0], a[1], f["project-key"]);
|
|
7
8
|
},
|
|
8
|
-
usage: "dss discussion list <objectType> <objectId> [--project-key KEY]",
|
|
9
9
|
description: "List discussions attached to a project object.",
|
|
10
10
|
examples: ["dss discussion list DATASET customers",],
|
|
11
11
|
},
|
|
12
12
|
get: {
|
|
13
13
|
handler: (c, a, f) => {
|
|
14
|
-
requireArgs(a, 3, "
|
|
14
|
+
requireArgs(a, 3, commandUsage("discussion", "get"));
|
|
15
15
|
return c.discussions.get(a[0], a[1], a[2], f["project-key"]);
|
|
16
16
|
},
|
|
17
|
-
usage: "dss discussion get <objectType> <objectId> <discussionId> [--project-key KEY]",
|
|
18
17
|
description: "Get one discussion with its replies.",
|
|
19
18
|
examples: ["dss discussion get DATASET customers d123",],
|
|
20
19
|
},
|
|
21
20
|
create: {
|
|
22
21
|
handler: (c, a, f) => {
|
|
23
|
-
requireArgs(a, 2, "
|
|
22
|
+
requireArgs(a, 2, commandUsage("discussion", "create"));
|
|
24
23
|
const topic = f["topic"];
|
|
25
24
|
const reply = f["reply"];
|
|
26
25
|
if (!topic || !reply) {
|
|
@@ -28,20 +27,18 @@ export const discussionCommands = {
|
|
|
28
27
|
}
|
|
29
28
|
return c.discussions.create(a[0], a[1], topic, reply, f["project-key"]);
|
|
30
29
|
},
|
|
31
|
-
usage: "dss discussion create <objectType> <objectId> --topic TEXT --reply TEXT [--project-key KEY]",
|
|
32
30
|
description: "Create a discussion with its first reply.",
|
|
33
31
|
examples: ["dss discussion create DATASET customers --topic Schema --reply Please-review",],
|
|
34
32
|
},
|
|
35
33
|
reply: {
|
|
36
34
|
handler: (c, a, f) => {
|
|
37
|
-
requireArgs(a, 3, "
|
|
35
|
+
requireArgs(a, 3, commandUsage("discussion", "reply"));
|
|
38
36
|
const text = f["text"];
|
|
39
37
|
if (!text)
|
|
40
38
|
throw new UsageError("--text is required.", "missing_required_flag");
|
|
41
39
|
return c.discussions.reply(a[0], a[1], a[2], text, f["project-key"]);
|
|
42
40
|
},
|
|
43
|
-
usage: "dss discussion reply <objectType> <objectId> <discussionId> --text TEXT [--project-key KEY]",
|
|
44
41
|
description: "Add a reply to an existing discussion.",
|
|
45
42
|
examples: ["dss discussion reply DATASET customers d123 --text Done",],
|
|
46
43
|
},
|
|
47
|
-
};
|
|
44
|
+
});
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
import { withUsage, } from "../syntax.js";
|
|
2
|
+
export const doctorCommands = withUsage("doctor", {
|
|
2
3
|
run: {
|
|
3
4
|
handler: async (_c, _a, f) => {
|
|
4
5
|
const { runDoctor, } = await import("../doctor.js");
|
|
5
6
|
return (await runDoctor(f)).result;
|
|
6
7
|
},
|
|
7
|
-
usage: "dss doctor [--project-key KEY] [--capabilities] [--fast]",
|
|
8
8
|
description: "Run JSON diagnostics for DSS credentials, connectivity, and project access.",
|
|
9
9
|
examples: ["dss doctor", "dss doctor --project-key MYPROJ", "dss doctor --capabilities --fast",],
|
|
10
10
|
},
|
|
11
|
-
};
|
|
11
|
+
});
|
|
@@ -3,8 +3,9 @@ import { deepMerge, } from "../../utils/deep-merge.js";
|
|
|
3
3
|
import { executionMode, } from "../flags.js";
|
|
4
4
|
import { ensureFlowZonePlanTarget, findFlowZoneForPlan, flowZoneColor, flowZoneContains, flowZoneCurrentPosition, flowZoneDetailSummary, flowZoneId, flowZoneMoveDelta, flowZoneMoveItems, flowZoneName, flowZoneOrganizeStep, flowZonePlanFromZones, flowZonePlanItemKeys, flowZonePruneItems, flowZoneSamePosition, flowZoneSummary, readFlowZoneOrganizePlan, resolveFlowZoneIdFromFlags, throwFlowZoneValidationError, validateFlowZoneOrganizeObjects, } from "../helpers/flow-zone.js";
|
|
5
5
|
import { readIfExists, skipResult, } from "../output.js";
|
|
6
|
+
import { commandUsage, withUsage, } from "../syntax.js";
|
|
6
7
|
import { requireArgs, UsageError, } from "../usage.js";
|
|
7
|
-
export const flowZoneCommands = {
|
|
8
|
+
export const flowZoneCommands = withUsage("flow-zone", {
|
|
8
9
|
list: {
|
|
9
10
|
handler: async (c, _a, f) => {
|
|
10
11
|
const zones = await c.flowZones.list(f["project-key"]);
|
|
@@ -14,7 +15,6 @@ export const flowZoneCommands = {
|
|
|
14
15
|
const object = objects.length === 1 ? objects[0] : undefined;
|
|
15
16
|
return zones.map((zone) => flowZoneSummary(zone, object));
|
|
16
17
|
},
|
|
17
|
-
usage: "dss flow-zone list [--summary] [--object TYPE:ID] [--project-key KEY]",
|
|
18
18
|
description: "List flow zones in a project, optionally as compact summaries.",
|
|
19
19
|
examples: ["dss flow-zone list", "dss flow-zone list --summary --object RECIPE:compute_orders",],
|
|
20
20
|
},
|
|
@@ -38,7 +38,6 @@ export const flowZoneCommands = {
|
|
|
38
38
|
.filter((zone) => flowZoneContains(zone, object))
|
|
39
39
|
.map((zone) => flowZoneSummary(zone, object));
|
|
40
40
|
},
|
|
41
|
-
usage: "dss flow-zone find [name-or-id] [--object TYPE:ID | --dataset DS | --recipe R | --folder F] [--project-key KEY]",
|
|
42
41
|
description: "Find flow zones by name/id or by contained flow object.",
|
|
43
42
|
examples: [
|
|
44
43
|
"dss flow-zone find ATH_SNW_MAP_FRG49",
|
|
@@ -48,10 +47,9 @@ export const flowZoneCommands = {
|
|
|
48
47
|
},
|
|
49
48
|
get: {
|
|
50
49
|
handler: (c, a, f) => {
|
|
51
|
-
requireArgs(a, 1, "
|
|
50
|
+
requireArgs(a, 1, commandUsage("flow-zone", "get"));
|
|
52
51
|
return c.flowZones.get(flowZoneId(a[0]), f["project-key"]);
|
|
53
52
|
},
|
|
54
|
-
usage: "dss flow-zone get <id> [--project-key KEY]",
|
|
55
53
|
description: "Get a flow zone by id.",
|
|
56
54
|
examples: ["dss flow-zone get ZONE_ID",],
|
|
57
55
|
},
|
|
@@ -84,7 +82,6 @@ export const flowZoneCommands = {
|
|
|
84
82
|
const created = await c.flowZones.create(payload);
|
|
85
83
|
return { created: created.id, resource: "flow-zone", ...created, };
|
|
86
84
|
},
|
|
87
|
-
usage: "dss flow-zone create --name NAME [--color #RRGGBB] [--if-not-exists] [--dry-run] [--project-key KEY]",
|
|
88
85
|
description: "Create a flow zone.",
|
|
89
86
|
examples: [
|
|
90
87
|
"dss flow-zone create --name Exports",
|
|
@@ -93,7 +90,7 @@ export const flowZoneCommands = {
|
|
|
93
90
|
},
|
|
94
91
|
update: {
|
|
95
92
|
handler: async (c, a, f) => {
|
|
96
|
-
requireArgs(a, 1, "
|
|
93
|
+
requireArgs(a, 1, commandUsage("flow-zone", "update"));
|
|
97
94
|
if (typeof f["name"] !== "string" && typeof f["color"] !== "string") {
|
|
98
95
|
throw new UsageError("--name and/or --color is required.");
|
|
99
96
|
}
|
|
@@ -111,13 +108,12 @@ export const flowZoneCommands = {
|
|
|
111
108
|
}
|
|
112
109
|
return c.flowZones.update(zoneId, patch);
|
|
113
110
|
},
|
|
114
|
-
usage: "dss flow-zone update <id> [--name NAME] [--color #RRGGBB] [--dry-run] [--project-key KEY]",
|
|
115
111
|
description: "Update flow zone settings.",
|
|
116
112
|
examples: ["dss flow-zone update ZONE_ID --name Exports --color '#2ab1ac' --dry-run",],
|
|
117
113
|
},
|
|
118
114
|
delete: {
|
|
119
115
|
handler: async (c, a, f) => {
|
|
120
|
-
requireArgs(a, 1, "
|
|
116
|
+
requireArgs(a, 1, commandUsage("flow-zone", "delete"));
|
|
121
117
|
const zoneId = flowZoneId(a[0]);
|
|
122
118
|
if (executionMode(f).dryRun || f["if-exists"] === true) {
|
|
123
119
|
const current = await readIfExists(() => c.flowZones.get(zoneId, f["project-key"]));
|
|
@@ -130,7 +126,6 @@ export const flowZoneCommands = {
|
|
|
130
126
|
await c.flowZones.delete(zoneId, f["project-key"]);
|
|
131
127
|
return { deleted: zoneId, resource: "flow-zone", };
|
|
132
128
|
},
|
|
133
|
-
usage: "dss flow-zone delete <id> [--if-exists] [--dry-run] [--project-key KEY]",
|
|
134
129
|
description: "Delete a flow zone. DSS moves zone items back to the default zone.",
|
|
135
130
|
examples: [
|
|
136
131
|
"dss flow-zone delete ZONE_ID --dry-run",
|
|
@@ -142,7 +137,7 @@ export const flowZoneCommands = {
|
|
|
142
137
|
const pk = f["project-key"];
|
|
143
138
|
const zoneId = a[0] ? flowZoneId(a[0]) : await resolveFlowZoneIdFromFlags(c, f, pk);
|
|
144
139
|
if (!zoneId) {
|
|
145
|
-
throw new UsageError(
|
|
140
|
+
throw new UsageError(`A zone id or --zone/--zone-id is required. Usage: ${commandUsage("flow-zone", "move")}`);
|
|
146
141
|
}
|
|
147
142
|
const items = flowZoneMoveItems(f);
|
|
148
143
|
if (items.length === 0) {
|
|
@@ -159,7 +154,6 @@ export const flowZoneCommands = {
|
|
|
159
154
|
}
|
|
160
155
|
return c.flowZones.moveItems(zoneId, items, pk);
|
|
161
156
|
},
|
|
162
|
-
usage: "dss flow-zone move [id] [--zone ZONE|--zone-id ID] [--dataset DS[,DS2]] [--recipe R] [--folder F] [--object TYPE:ID] [--dry-run] [--project-key KEY]",
|
|
163
157
|
description: "Move datasets, recipes, managed folders, or other flow objects into a zone by id or --zone name.",
|
|
164
158
|
examples: [
|
|
165
159
|
"dss flow-zone move ZONE_ID --dataset orders --dry-run",
|
|
@@ -177,13 +171,12 @@ export const flowZoneCommands = {
|
|
|
177
171
|
]);
|
|
178
172
|
return flowZonePlanFromZones(zones, topologyFingerprint);
|
|
179
173
|
},
|
|
180
|
-
usage: "dss flow-zone plan [--project-key KEY]",
|
|
181
174
|
description: "Export current visual flow-zone organization as an organize-compatible plan.",
|
|
182
175
|
examples: ["dss flow-zone plan --project-key MYPROJ",],
|
|
183
176
|
},
|
|
184
177
|
organize: {
|
|
185
178
|
handler: async (c, _a, f) => {
|
|
186
|
-
const usage = "
|
|
179
|
+
const usage = commandUsage("flow-zone", "organize");
|
|
187
180
|
const pk = f["project-key"];
|
|
188
181
|
const plan = readFlowZoneOrganizePlan(f, usage);
|
|
189
182
|
const sync = f["sync"] === true;
|
|
@@ -292,7 +285,6 @@ export const flowZoneCommands = {
|
|
|
292
285
|
pruned,
|
|
293
286
|
};
|
|
294
287
|
},
|
|
295
|
-
usage: "dss flow-zone organize (--data JSON|--data-file PATH|--file PATH|--stdin) [--sync] [--validate-objects] [--dry-run] [--project-key KEY]",
|
|
296
288
|
description: "Create/update flow zones and move objects from a declarative visual organization plan.",
|
|
297
289
|
examples: [
|
|
298
290
|
"dss flow-zone organize --file flow-zones.json --dry-run",
|
|
@@ -304,8 +296,7 @@ export const flowZoneCommands = {
|
|
|
304
296
|
const id = a[0] === undefined ? undefined : flowZoneId(a[0]);
|
|
305
297
|
return c.flowZones.graph(id, f["project-key"]);
|
|
306
298
|
},
|
|
307
|
-
usage: "dss flow-zone graph [<id>] [--project-key KEY]",
|
|
308
299
|
description: "Get the full flow graph or the graph for a single flow zone.",
|
|
309
300
|
examples: ["dss flow-zone graph", "dss flow-zone graph ZONE_ID",],
|
|
310
301
|
},
|
|
311
|
-
};
|
|
302
|
+
});
|