dataiku-sdk 3.6.1 → 3.8.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 +14 -6
- package/bin/bun-version.js +14 -0
- package/bin/dss.js +11 -15
- package/dist/build-metadata.json +1 -1
- package/dist/packages/types/src/index.d.ts +114 -5
- package/dist/packages/types/src/index.js +75 -2
- package/dist/src/cli/coerce.d.ts +2 -0
- package/dist/src/cli/coerce.js +20 -16
- package/dist/src/cli/command-syntax.json +3369 -144
- package/dist/src/cli/commands/analysis.js +19 -1
- package/dist/src/cli/commands/bundle.js +22 -0
- package/dist/src/cli/commands/connection.js +26 -2
- package/dist/src/cli/commands/data-quality.js +33 -1
- package/dist/src/cli/commands/dataset.js +76 -9
- package/dist/src/cli/commands/discussion.js +15 -0
- package/dist/src/cli/commands/doctor.js +1 -1
- package/dist/src/cli/commands/flow-zone.js +241 -46
- package/dist/src/cli/commands/flow.d.ts +5 -0
- package/dist/src/cli/commands/flow.js +57 -0
- package/dist/src/cli/commands/future.js +8 -0
- package/dist/src/cli/commands/index.js +6 -0
- package/dist/src/cli/commands/job.js +44 -6
- package/dist/src/cli/commands/metrics.js +21 -1
- package/dist/src/cli/commands/ml-task.d.ts +5 -0
- package/dist/src/cli/commands/ml-task.js +86 -16
- package/dist/src/cli/commands/mlflow.d.ts +11 -0
- package/dist/src/cli/commands/mlflow.js +121 -0
- package/dist/src/cli/commands/plugin.js +5 -11
- package/dist/src/cli/commands/project-deployer.js +70 -0
- package/dist/src/cli/commands/project-library.js +2 -5
- package/dist/src/cli/commands/project.js +8 -0
- package/dist/src/cli/commands/recipe.d.ts +13 -0
- package/dist/src/cli/commands/recipe.js +130 -7
- package/dist/src/cli/commands/saved-model.d.ts +1 -1
- package/dist/src/cli/commands/saved-model.js +9 -76
- package/dist/src/cli/commands/streaming-endpoint.js +30 -1
- package/dist/src/cli/commands/webapp.js +8 -0
- package/dist/src/cli/commands/wiki.js +78 -0
- package/dist/src/cli/commands/workspace.js +8 -0
- package/dist/src/cli/contract.d.ts +16 -15
- package/dist/src/cli/contract.js +150 -3407
- package/dist/src/cli/doctor.d.ts +13 -0
- package/dist/src/cli/doctor.js +43 -1
- package/dist/src/cli/flags.d.ts +14 -1
- package/dist/src/cli/flags.js +106 -8
- package/dist/src/cli/helpers/app-successor.js +1 -2
- package/dist/src/cli/helpers/dataset.d.ts +12 -0
- package/dist/src/cli/helpers/dataset.js +36 -0
- package/dist/src/cli/helpers/documentation.d.ts +21 -0
- package/dist/src/cli/helpers/documentation.js +53 -0
- package/dist/src/cli/helpers/flow-zone.d.ts +21 -0
- package/dist/src/cli/helpers/flow-zone.js +144 -4
- package/dist/src/cli/helpers/trained-model.d.ts +26 -0
- package/dist/src/cli/helpers/trained-model.js +144 -0
- package/dist/src/cli/list-output.d.ts +7 -0
- package/dist/src/cli/list-output.js +77 -0
- package/dist/src/cli/list-shapes.d.ts +21 -0
- package/dist/src/cli/list-shapes.js +111 -0
- package/dist/src/cli/output-schemas.d.ts +0 -14
- package/dist/src/cli/output-schemas.js +4 -7
- package/dist/src/cli/output.d.ts +0 -1
- package/dist/src/cli/output.js +33 -19
- package/dist/src/cli/plans.d.ts +14 -0
- package/dist/src/cli/plans.js +3740 -0
- package/dist/src/cli/types.d.ts +2 -0
- package/dist/src/cli/usage.d.ts +7 -0
- package/dist/src/cli/usage.js +20 -1
- package/dist/src/cli/version.d.ts +2 -2
- package/dist/src/cli/version.js +2 -2
- package/dist/src/cli.js +137 -115
- package/dist/src/client.d.ts +52 -43
- package/dist/src/client.js +267 -96
- package/dist/src/errors.d.ts +22 -2
- package/dist/src/errors.js +49 -50
- package/dist/src/generated/action-output-schemas.json +345 -89
- package/dist/src/index.d.ts +5 -1
- package/dist/src/index.js +3 -0
- package/dist/src/resources/analyses.d.ts +8 -0
- package/dist/src/resources/analyses.js +13 -1
- package/dist/src/resources/bundles.d.ts +34 -0
- package/dist/src/resources/bundles.js +67 -0
- package/dist/src/resources/connections.d.ts +9 -0
- package/dist/src/resources/connections.js +15 -0
- package/dist/src/resources/data-quality.d.ts +20 -0
- package/dist/src/resources/data-quality.js +30 -0
- package/dist/src/resources/dataset-create.d.ts +38 -0
- package/dist/src/resources/dataset-create.js +135 -0
- package/dist/src/resources/datasets.d.ts +46 -15
- package/dist/src/resources/datasets.js +120 -112
- package/dist/src/resources/discussions.d.ts +5 -0
- package/dist/src/resources/discussions.js +7 -0
- package/dist/src/resources/documentation.d.ts +25 -0
- package/dist/src/resources/documentation.js +16 -0
- package/dist/src/resources/flow-zones.d.ts +29 -3
- package/dist/src/resources/flow-zones.js +53 -3
- package/dist/src/resources/flow.d.ts +48 -0
- package/dist/src/resources/flow.js +65 -0
- package/dist/src/resources/futures.d.ts +23 -0
- package/dist/src/resources/futures.js +32 -0
- package/dist/src/resources/jobs.d.ts +34 -0
- package/dist/src/resources/jobs.js +170 -3
- package/dist/src/resources/metrics.d.ts +10 -0
- package/dist/src/resources/metrics.js +10 -0
- package/dist/src/resources/ml-tasks.d.ts +65 -2
- package/dist/src/resources/ml-tasks.js +102 -28
- package/dist/src/resources/mlflow-extension.d.ts +73 -0
- package/dist/src/resources/mlflow-extension.js +105 -0
- package/dist/src/resources/projects.d.ts +15 -0
- package/dist/src/resources/projects.js +18 -3
- package/dist/src/resources/recipe-create.d.ts +79 -0
- package/dist/src/resources/recipe-create.js +454 -0
- package/dist/src/resources/recipes.d.ts +28 -29
- package/dist/src/resources/recipes.js +201 -267
- package/dist/src/resources/saved-models.d.ts +10 -6
- package/dist/src/resources/saved-models.js +16 -14
- package/dist/src/resources/scenarios.js +8 -14
- package/dist/src/resources/sql.js +52 -13
- package/dist/src/resources/streaming-endpoints.d.ts +12 -0
- package/dist/src/resources/streaming-endpoints.js +15 -0
- package/dist/src/resources/trained-model.d.ts +60 -0
- package/dist/src/resources/trained-model.js +98 -0
- package/dist/src/resources/webapps.d.ts +8 -0
- package/dist/src/resources/webapps.js +10 -0
- package/dist/src/resources/wiki.d.ts +52 -1
- package/dist/src/resources/wiki.js +96 -0
- package/dist/src/resources/workspaces.d.ts +2 -0
- package/dist/src/resources/workspaces.js +4 -0
- package/dist/src/utils/flow-analysis.js +4 -0
- package/dist/src/utils/response-file.js +20 -9
- package/dist/src/utils/secret-sanitize.d.ts +7 -0
- package/dist/src/utils/secret-sanitize.js +46 -0
- package/package.json +25 -26
- package/plugin.json +1 -1
- package/skills/dataiku-dss/SKILL.md +1 -1
- package/skills/dataiku-dss/references/authentication.md +3 -1
- package/skills/dataiku-dss/references/coding.md +1 -0
- package/skills/dataiku-dss/references/discovery.md +4 -6
- package/skills/dataiku-dss/references/flow-maps.md +2 -2
- package/skills/dataiku-dss/references/troubleshooting.md +3 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { requiredStringFlag, } from "../coerce.js";
|
|
1
|
+
import { requiredJsonInput, requiredStringFlag, } from "../coerce.js";
|
|
2
2
|
import { executionMode, } from "../flags.js";
|
|
3
3
|
import { readIfExists, skipResult, } from "../output.js";
|
|
4
4
|
import { commandUsage, withUsage, } from "../syntax.js";
|
|
@@ -61,4 +61,22 @@ export const analysisCommands = withUsage("analysis", {
|
|
|
61
61
|
"dss analysis delete ANALYSIS_ID --dry-run --project-key PROJECT",
|
|
62
62
|
],
|
|
63
63
|
},
|
|
64
|
+
update: {
|
|
65
|
+
handler: async (c, a, f) => {
|
|
66
|
+
requireArgs(a, 1, commandUsage("analysis", "update"));
|
|
67
|
+
const definition = requiredJsonInput(f, "The analysis definition is required via --data, --data-file, or --stdin (dss analysis get, edited).");
|
|
68
|
+
await c.analyses.update(a[0], definition, f["project-key"]);
|
|
69
|
+
return { updated: a[0], resource: "analysis", };
|
|
70
|
+
},
|
|
71
|
+
description: "Replace a visual analysis definition (name, script steps, charts, tags) with the object from dss analysis get, edited.",
|
|
72
|
+
examples: ["dss analysis update ANALYSIS_ID --data-file analysis.json",],
|
|
73
|
+
},
|
|
74
|
+
"list-ml-tasks": {
|
|
75
|
+
handler: (c, a, f) => {
|
|
76
|
+
requireArgs(a, 1, commandUsage("analysis", "list-ml-tasks"));
|
|
77
|
+
return c.analyses.listMlTasks(a[0], f["project-key"]);
|
|
78
|
+
},
|
|
79
|
+
description: "List the ML tasks of one visual analysis (whole project: dss ml-task list).",
|
|
80
|
+
examples: ["dss analysis list-ml-tasks ANALYSIS_ID",],
|
|
81
|
+
},
|
|
64
82
|
});
|
|
@@ -131,4 +131,26 @@ export const bundleCommands = withUsage("bundle", {
|
|
|
131
131
|
description: "Delete an imported Automation-node bundle.",
|
|
132
132
|
examples: ["dss bundle delete-imported v1",],
|
|
133
133
|
},
|
|
134
|
+
"get-exported": {
|
|
135
|
+
handler: (c, a, f) => c.bundles.getExported(a[0], f["project-key"]),
|
|
136
|
+
description: "Get an exported bundle's details (content summary, export manifest, changelog).",
|
|
137
|
+
examples: ["dss bundle get-exported v1",],
|
|
138
|
+
},
|
|
139
|
+
"create-project": {
|
|
140
|
+
handler: async (c, _a, f) => {
|
|
141
|
+
const file = f["file"];
|
|
142
|
+
const archive = f["archive-path"];
|
|
143
|
+
if ((typeof file === "string") === (typeof archive === "string")) {
|
|
144
|
+
throw new UsageError("Pass exactly one of --file PATH (local bundle zip) or --archive-path PATH (zip on the Automation node).", "missing_required_flag");
|
|
145
|
+
}
|
|
146
|
+
const folder = f["project-folder"];
|
|
147
|
+
const result = await c.bundles.createProjectFromBundle(typeof file === "string" ? { filePath: file, } : { archivePath: archive, }, folder);
|
|
148
|
+
return result ?? { created: true, resource: "bundle", };
|
|
149
|
+
},
|
|
150
|
+
description: "Automation node (global admin): create a new project from a bundle, uploading --file PATH or using --archive-path PATH on the node host; --project-folder places it.",
|
|
151
|
+
examples: [
|
|
152
|
+
"dss bundle create-project --file bundle-v1.zip",
|
|
153
|
+
"dss bundle create-project --archive-path /data/bundles/v1.zip",
|
|
154
|
+
],
|
|
155
|
+
},
|
|
134
156
|
});
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { DataikuError, } from "../../errors.js";
|
|
1
2
|
import { sanitizeErrorSecrets, sanitizeSecrets, } from "../../utils/secret-sanitize.js";
|
|
2
3
|
import { requiredJsonInput, } from "../coerce.js";
|
|
3
4
|
import { executionMode, } from "../flags.js";
|
|
@@ -26,6 +27,7 @@ const SENSITIVE_CONNECTION_KEYS = {
|
|
|
26
27
|
refreshtoken: true,
|
|
27
28
|
secret: true,
|
|
28
29
|
secretkey: true,
|
|
30
|
+
sessiontoken: true,
|
|
29
31
|
sharesecret: true,
|
|
30
32
|
token: true,
|
|
31
33
|
};
|
|
@@ -97,12 +99,34 @@ export const connectionCommands = withUsage("connection", {
|
|
|
97
99
|
handler: async (c, a) => {
|
|
98
100
|
const usage = commandUsage("connection", "get");
|
|
99
101
|
requireArgs(a, 1, usage);
|
|
100
|
-
const
|
|
101
|
-
|
|
102
|
+
const name = requireConnectionName(a[0], usage);
|
|
103
|
+
try {
|
|
104
|
+
const details = await c.connections.adminGet(name);
|
|
105
|
+
return sanitizeConnectionSecrets(details);
|
|
106
|
+
}
|
|
107
|
+
catch (error) {
|
|
108
|
+
if (error instanceof DataikuError && error.status === 403) {
|
|
109
|
+
// The admin endpoint refuses non-admin keys for every connection,
|
|
110
|
+
// including ones they can query; status, code, and exit stay as is.
|
|
111
|
+
error.retryHint =
|
|
112
|
+
"connection get reads the admin definition. For a connection this key can use, run `dss connection info NAME`; `dss doctor` shows which identity the key acts as.";
|
|
113
|
+
}
|
|
114
|
+
throw error;
|
|
115
|
+
}
|
|
102
116
|
},
|
|
103
117
|
description: "Get a connection by name (admin). Credential-bearing params (e.g. params.password) are redacted in output.",
|
|
104
118
|
examples: ["dss connection get postgres",],
|
|
105
119
|
},
|
|
120
|
+
info: {
|
|
121
|
+
handler: async (c, a) => {
|
|
122
|
+
const usage = commandUsage("connection", "info");
|
|
123
|
+
requireArgs(a, 1, usage);
|
|
124
|
+
const details = await c.connections.info(requireConnectionName(a[0], usage));
|
|
125
|
+
return sanitizeConnectionSecrets(details);
|
|
126
|
+
},
|
|
127
|
+
description: "Read a connection's usage view (no admin privilege required): type, params, and credentials mode for every connection the key can query, where `connection get` (admin) answers 403. Credential-bearing params (e.g. params.password) are redacted in output.",
|
|
128
|
+
examples: ["dss connection info postgres",],
|
|
129
|
+
},
|
|
106
130
|
create: {
|
|
107
131
|
handler: async (c, _a, f) => {
|
|
108
132
|
const usage = commandUsage("connection", "create");
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { deepMerge, } from "../../utils/deep-merge.js";
|
|
2
|
-
import { num, parseBooleanOption, requiredJsonInput, } from "../coerce.js";
|
|
2
|
+
import { num, parseBooleanOption, requiredJsonInput, splitCsvFlag, } from "../coerce.js";
|
|
3
3
|
import { executionMode, } from "../flags.js";
|
|
4
4
|
import { encodedProjectEndpoint, readIfExists, skipResult, } from "../output.js";
|
|
5
5
|
import { commandUsage, withUsage, } from "../syntax.js";
|
|
@@ -41,6 +41,38 @@ export const dataQualityCommands = withUsage("data-quality", {
|
|
|
41
41
|
description: "Get the aggregate data quality status for a dataset.",
|
|
42
42
|
examples: ["dss data-quality status orders",],
|
|
43
43
|
},
|
|
44
|
+
"instance-status": {
|
|
45
|
+
handler: (c) => c.dataQuality.instanceStatus(),
|
|
46
|
+
description: "Data quality status of every monitored project you can read, keyed by project key (ok/warning/error/empty rule counts, last run).",
|
|
47
|
+
examples: ["dss data-quality instance-status",],
|
|
48
|
+
},
|
|
49
|
+
"partitions-status": {
|
|
50
|
+
handler: (c, a, f) => c.dataQuality.partitionsStatus(a[0], {
|
|
51
|
+
projectKey: f["project-key"],
|
|
52
|
+
partitions: splitCsvFlag(f["partitions"]),
|
|
53
|
+
}),
|
|
54
|
+
description: "Last data quality outcome for specific partitions of a dataset (--partitions P1,P2); a non-partitioned dataset needs none.",
|
|
55
|
+
examples: ["dss data-quality partitions-status orders --partitions 2026-01,2026-02",],
|
|
56
|
+
},
|
|
57
|
+
"delete-history": {
|
|
58
|
+
handler: async (c, a, f) => {
|
|
59
|
+
const partition = f["partition"] ?? "NP";
|
|
60
|
+
const pk = f["project-key"];
|
|
61
|
+
if (executionMode(f).dryRun) {
|
|
62
|
+
return {
|
|
63
|
+
dryRun: true,
|
|
64
|
+
action: "delete-history",
|
|
65
|
+
resource: "data-quality",
|
|
66
|
+
dataset: a[0],
|
|
67
|
+
partition,
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
await c.dataQuality.deleteHistory(a[0], { projectKey: pk, partition, });
|
|
71
|
+
return { deleted: "history", resource: "data-quality", dataset: a[0], partition, };
|
|
72
|
+
},
|
|
73
|
+
description: "Delete data quality rule history of a dataset partition (--partition, default NP; ALL for every partition).",
|
|
74
|
+
examples: ["dss data-quality delete-history orders --partition ALL --dry-run",],
|
|
75
|
+
},
|
|
44
76
|
"create-rule": {
|
|
45
77
|
handler: async (c, a, f) => {
|
|
46
78
|
requireArgs(a, 1, commandUsage("data-quality", "create-rule"));
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import { assertDatasetTypeCreatable, buildDatasetCreateBody, } from "../../resources/dataset-create.js";
|
|
1
2
|
import { deepMerge, } from "../../utils/deep-merge.js";
|
|
2
3
|
import { isRecord, } from "../../utils/records.js";
|
|
3
4
|
import { compareStrings, stableHash, } from "../../utils/stable-hash.js";
|
|
4
|
-
import { jsonInput, num, schemaColumnsInput, unknownJsonInput, } from "../coerce.js";
|
|
5
|
+
import { jsonInput, num, schemaColumnsInput, splitCsvFlag, unknownJsonInput, } from "../coerce.js";
|
|
5
6
|
import { executionMode, } from "../flags.js";
|
|
6
|
-
import { datasetSourceSummary, } from "../helpers/dataset.js";
|
|
7
|
+
import { datasetSourceSummary, datasetSqlSourceFromFlags, } from "../helpers/dataset.js";
|
|
7
8
|
import { moveCreatedItemsToZone, resolveFlowZoneIdFromFlags, } from "../helpers/flow-zone.js";
|
|
8
9
|
import { enqueueCliWarning, readIfExists, skipResult, } from "../output.js";
|
|
9
10
|
import { commandUsage, withUsage, } from "../syntax.js";
|
|
@@ -96,6 +97,14 @@ export function compareDatasetSchemas(expected, actual) {
|
|
|
96
97
|
differencesTruncated: acc.items.length < acc.total,
|
|
97
98
|
};
|
|
98
99
|
}
|
|
100
|
+
/** `--columns` / `--partitions` read selection (served by the POST variant of the data endpoint). */
|
|
101
|
+
function dataSelectionFromFlags(f) {
|
|
102
|
+
const columns = splitCsvFlag(f["columns"]);
|
|
103
|
+
return {
|
|
104
|
+
...(columns.length > 0 ? { columns, } : {}),
|
|
105
|
+
...(typeof f["partitions"] === "string" ? { partitions: f["partitions"], } : {}),
|
|
106
|
+
};
|
|
107
|
+
}
|
|
99
108
|
export const datasetCommands = withUsage("dataset", {
|
|
100
109
|
list: {
|
|
101
110
|
handler: (c, _a, f) => c.datasets.list(f["project-key"]),
|
|
@@ -225,6 +234,7 @@ export const datasetCommands = withUsage("dataset", {
|
|
|
225
234
|
maxRows,
|
|
226
235
|
projectKey: f["project-key"],
|
|
227
236
|
timeoutMs: num(f["timeout"], "--timeout"),
|
|
237
|
+
...dataSelectionFromFlags(f),
|
|
228
238
|
});
|
|
229
239
|
if (result.truncated) {
|
|
230
240
|
enqueueCliWarning({
|
|
@@ -239,8 +249,11 @@ export const datasetCommands = withUsage("dataset", {
|
|
|
239
249
|
}
|
|
240
250
|
return result;
|
|
241
251
|
},
|
|
242
|
-
description: "Preview dataset rows (--rows is an alias for --max-rows). Returns { columns, rows, rowCount, truncated, limit };
|
|
243
|
-
examples: [
|
|
252
|
+
description: "Preview dataset rows (--rows is an alias for --max-rows); --columns COLS and --partitions SPEC narrow the read. Returns { columns, rows, rowCount, truncated, limit }; a dataset_preview_truncated warning on stderr flags more rows.",
|
|
253
|
+
examples: [
|
|
254
|
+
"dss dataset preview orders",
|
|
255
|
+
"dss dataset preview orders --rows 5 --columns id,amount",
|
|
256
|
+
],
|
|
244
257
|
},
|
|
245
258
|
"assert-count": {
|
|
246
259
|
handler: async (c, a, f) => {
|
|
@@ -291,6 +304,22 @@ export const datasetCommands = withUsage("dataset", {
|
|
|
291
304
|
description: "Get dataset-level metadata.",
|
|
292
305
|
examples: ["dss dataset metadata orders",],
|
|
293
306
|
},
|
|
307
|
+
"sync-hive-metastore": {
|
|
308
|
+
handler: async (c, a, f) => {
|
|
309
|
+
await c.datasets.synchronizeHiveMetastore(a[0], f["project-key"]);
|
|
310
|
+
return { synchronized: a[0], resource: "dataset", };
|
|
311
|
+
},
|
|
312
|
+
description: "Create or update the Hive table of an HDFS dataset to match its schema (Hive metastore sync). HDFS datasets only.",
|
|
313
|
+
examples: ["dss dataset sync-hive-metastore web_logs",],
|
|
314
|
+
},
|
|
315
|
+
"update-from-hive": {
|
|
316
|
+
handler: async (c, a, f) => {
|
|
317
|
+
await c.datasets.updateFromHive(a[0], f["project-key"]);
|
|
318
|
+
return { updated: a[0], resource: "dataset", };
|
|
319
|
+
},
|
|
320
|
+
description: "Update an HDFS dataset's path, schema, partitioning, and format from its Hive metastore table. HDFS datasets only.",
|
|
321
|
+
examples: ["dss dataset update-from-hive web_logs --plan",],
|
|
322
|
+
},
|
|
294
323
|
"metadata-set": {
|
|
295
324
|
handler: async (c, a, f) => {
|
|
296
325
|
const usage = commandUsage("dataset", "metadata-set");
|
|
@@ -333,14 +362,18 @@ export const datasetCommands = withUsage("dataset", {
|
|
|
333
362
|
if (!name || !dsType) {
|
|
334
363
|
throw new UsageError(`--name and --type are required. Usage: ${commandUsage("dataset", "create")}`);
|
|
335
364
|
}
|
|
365
|
+
assertDatasetTypeCreatable(dsType);
|
|
336
366
|
if (!connection && dsType.toLowerCase() !== "uploadedfiles") {
|
|
337
367
|
throw new UsageError("--connection is required unless --type is UploadedFiles.");
|
|
338
368
|
}
|
|
369
|
+
const sqlSource = datasetSqlSourceFromFlags(f, dsType);
|
|
370
|
+
const hasSqlSource = sqlSource.table !== undefined || sqlSource.query !== undefined;
|
|
339
371
|
const payload = {
|
|
340
372
|
datasetName: name,
|
|
341
373
|
connection,
|
|
342
374
|
dsType,
|
|
343
375
|
projectKey: pk,
|
|
376
|
+
...sqlSource,
|
|
344
377
|
};
|
|
345
378
|
const zoneId = await resolveFlowZoneIdFromFlags(c, f, pk);
|
|
346
379
|
if (f["if-not-exists"] === true || executionMode(f).dryRun) {
|
|
@@ -356,20 +389,53 @@ export const datasetCommands = withUsage("dataset", {
|
|
|
356
389
|
resource: "dataset",
|
|
357
390
|
name,
|
|
358
391
|
payload,
|
|
392
|
+
...(hasSqlSource
|
|
393
|
+
? {
|
|
394
|
+
request: {
|
|
395
|
+
method: "POST",
|
|
396
|
+
endpoint: `/public/api/projects/${encodeURIComponent(c.resolveProjectKey(pk))}/datasets/`,
|
|
397
|
+
body: buildDatasetCreateBody({
|
|
398
|
+
...payload,
|
|
399
|
+
projectKey: c.resolveProjectKey(pk),
|
|
400
|
+
}),
|
|
401
|
+
},
|
|
402
|
+
schemaDetection: "After the POST, DSS detects the schema (POST /actions/testAndDetectSettings/externalSQL) and it is stored (PUT /schema).",
|
|
403
|
+
}
|
|
404
|
+
: {}),
|
|
359
405
|
...(existing ? { current: existing, } : {}),
|
|
360
406
|
...(zoneId ? { zoneId, zoneMove: [{ objectId: name, objectType: "DATASET", },], } : {}),
|
|
361
407
|
};
|
|
362
408
|
}
|
|
363
409
|
}
|
|
364
410
|
await c.datasets.create(payload);
|
|
411
|
+
const detection = hasSqlSource ? await c.datasets.detectSqlSchema(name, pk) : undefined;
|
|
412
|
+
if (detection && !detection.detected) {
|
|
413
|
+
enqueueCliWarning({
|
|
414
|
+
code: "dataset_schema_not_detected",
|
|
415
|
+
dataset: name,
|
|
416
|
+
error: detection.error,
|
|
417
|
+
hint: `The dataset was kept without columns. Fix the connection, table, or query, then set the columns with dss dataset refresh-schema ${name}.`,
|
|
418
|
+
});
|
|
419
|
+
}
|
|
365
420
|
const moved = await moveCreatedItemsToZone(c, f, [{ objectId: name, objectType: "DATASET", },], pk);
|
|
366
|
-
return {
|
|
421
|
+
return {
|
|
422
|
+
created: name,
|
|
423
|
+
resource: "dataset",
|
|
424
|
+
...(detection
|
|
425
|
+
? {
|
|
426
|
+
schemaDetected: detection.detected,
|
|
427
|
+
columns: detection.columns,
|
|
428
|
+
...(detection.error !== undefined ? { schemaError: detection.error, } : {}),
|
|
429
|
+
}
|
|
430
|
+
: {}),
|
|
431
|
+
...moved,
|
|
432
|
+
};
|
|
367
433
|
},
|
|
368
|
-
description: "Create a
|
|
434
|
+
description: "Create a dataset. SQL types: --table or --query, schema auto-detected.",
|
|
369
435
|
examples: [
|
|
370
436
|
"dss dataset create --name uploads --type UploadedFiles",
|
|
371
|
-
"dss dataset create --name
|
|
372
|
-
"dss dataset create --name
|
|
437
|
+
"dss dataset create --name sales --type Snowflake --connection sf --table SALES --schema PUBLIC",
|
|
438
|
+
"dss dataset create --name big --type PostgreSQL --connection pg --query-file big.sql --dry-run",
|
|
373
439
|
],
|
|
374
440
|
},
|
|
375
441
|
"create-managed": {
|
|
@@ -472,6 +538,7 @@ export const datasetCommands = withUsage("dataset", {
|
|
|
472
538
|
projectKey: f["project-key"],
|
|
473
539
|
limit: num(f["limit"], "--limit"),
|
|
474
540
|
rawData: f["raw-data"] === true,
|
|
541
|
+
...dataSelectionFromFlags(f),
|
|
475
542
|
});
|
|
476
543
|
if (result.truncated) {
|
|
477
544
|
enqueueCliWarning({
|
|
@@ -495,7 +562,7 @@ export const datasetCommands = withUsage("dataset", {
|
|
|
495
562
|
}
|
|
496
563
|
return result;
|
|
497
564
|
},
|
|
498
|
-
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.
|
|
565
|
+
description: "Download up to --limit rows (default 100k) as CSV and return { path, rows, truncated, limit }; --columns COLS and --partitions SPEC narrow the read. Formula-like cells are neutralized for spreadsheets; --raw-data preserves exact bytes.",
|
|
499
566
|
examples: [
|
|
500
567
|
"dss dataset download orders",
|
|
501
568
|
"dss dataset download orders --output ./data/",
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { jsonInput, } from "../coerce.js";
|
|
1
2
|
import { commandUsage, withUsage, } from "../syntax.js";
|
|
2
3
|
import { requireArgs, UsageError, } from "../usage.js";
|
|
3
4
|
export const discussionCommands = withUsage("discussion", {
|
|
@@ -41,4 +42,18 @@ export const discussionCommands = withUsage("discussion", {
|
|
|
41
42
|
description: "Add a reply to an existing discussion.",
|
|
42
43
|
examples: ["dss discussion reply DATASET customers d123 --text Done",],
|
|
43
44
|
},
|
|
45
|
+
update: {
|
|
46
|
+
handler: async (c, a, f) => {
|
|
47
|
+
const pk = f["project-key"];
|
|
48
|
+
const body = jsonInput(f);
|
|
49
|
+
const topic = f["topic"];
|
|
50
|
+
if ((body === undefined) === (typeof topic !== "string")) {
|
|
51
|
+
throw new UsageError("Pass exactly one of --topic TEXT or --data/--data-file/--stdin.", "missing_required_flag");
|
|
52
|
+
}
|
|
53
|
+
const next = body ?? { ...await c.discussions.get(a[0], a[1], a[2], pk), topic, };
|
|
54
|
+
return c.discussions.update(a[0], a[1], a[2], next, pk);
|
|
55
|
+
},
|
|
56
|
+
description: "Update a discussion: --topic TEXT edits the topic of the current discussion, or --data sends a full discussion object from get (e.g. to move it to another object of the project).",
|
|
57
|
+
examples: ['dss discussion update DATASET orders L8gkpoI6 --topic "Schema change (edited)"',],
|
|
58
|
+
},
|
|
44
59
|
});
|
|
@@ -5,7 +5,7 @@ export const doctorCommands = withUsage("doctor", {
|
|
|
5
5
|
const { runDoctor, } = await import("../doctor.js");
|
|
6
6
|
return (await runDoctor(f)).result;
|
|
7
7
|
},
|
|
8
|
-
description: "Run JSON diagnostics for DSS credentials, connectivity, and project access.",
|
|
8
|
+
description: "Run JSON diagnostics for DSS credentials, connectivity, and project access, and report the identity (whoami: user, groups, auth source) the API key acts as.",
|
|
9
9
|
examples: ["dss doctor", "dss doctor --project-key MYPROJ", "dss doctor --capabilities --fast",],
|
|
10
10
|
},
|
|
11
11
|
});
|