Skip to content

feat: cz-cli task param system, JDBC datasource binding, execute improvements - #8

Merged
yunqiqiliang merged 3 commits into
mainfrom
feat/cz-cli-ts-rewrite
May 15, 2026
Merged

yunqiqiliang merged 3 commits into
mainfrom
feat/cz-cli-ts-rewrite

Conversation

@yunqiqiliang

Copy link
Copy Markdown
Collaborator

Summary

This PR merges the feat/cz-cli-ts-rewrite branch into main, including 143 commits of feature work and bug fixes. The changes most relevant to this session are highlighted below.

Task Parameter System

  • task save-content --params now auto-detects paramType=system for built-in system params (bizdate, sys_biz_day, sys_biz_datetime, sys_plan_day, sys_plan_datetime, sys_plan_timestamp, sys_task_id, sys_task_name, sys_task_owner) and time expressions starting with $[
  • task content now returns params, input_params, output_params fields from the raw API response
  • task execute auto-loads saved manual params as defaults; --param KEY=VAL overrides; warns to stderr when unresolved ${placeholders} remain after merge (SQL tasks will fail; Python/Shell silently keep literal strings)

JDBC Task Datasource Binding

  • task content parses adhocConfigs and returns datasource_id, session_schema_name, ds_type fields
  • task execute auto-resolves JDBC datasource config from saved adhocConfigs; new --datasource <name|id> and --database <db> flags for override or new tasks
  • --datasource accepts name or numeric ID; dsType is auto-resolved via datasource API (fixes dsType is null error on new JDBC tasks)
  • Added missing JDBC-supported datasource types: Aurora MySQL (39), Aurora PostgreSQL (40), PolarDB PostgreSQL (48); fixed PolarDB (19) display name

Runs Refill

  • runs refill --from/--to describe updated to clarify YYYY-MM-DD (day boundary) vs YYYY-MM-DDTHH:MM:SS (exact datetime for hourly/minutely task backfills)

SKILL / Documentation

  • Added Rule 3.1 to SKILL.template.md: 补数/回填 → runs refill routing hint
  • Updated cz-cli-inner/SKILL.md with new execute, refill, save-content behavior
  • locale.ts task_content message updated to describe params field and paramType semantics

Testing

All changes verified against live ClickZetta Lakehouse environment:

  • SQL/Python/Shell task param injection (manual + system types)
  • JDBC task execute with saved adhocConfigs (auto-resolve)
  • JDBC task execute with --datasource aliyun_mysql --database clickzetta_authority (new task, name lookup)
  • task content returning datasource fields
  • runs refill datetime format behavior

yunqiqiliang and others added 3 commits May 15, 2026 19:06
- task content now parses adhocConfigs JSON and returns datasource_id,
  session_schema_name, ds_type fields for JDBC tasks
- task execute auto-resolves datasourceId/sessionSchemaName/dsType from
  saved adhocConfigs; --datasource and --database flags allow override
- SDK ExecuteAdhocParams extended with optional datasourceId,
  sessionSchemaName, dsType fields passed to /adhoc/execute endpoint
- fixes "获取数据源配置异常" error when executing JDBC tasks via CLI

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
…or id

- --datasource now accepts datasource name or numeric ID (string type)
- dsType is auto-resolved via resolveDatasource() when --datasource is
  provided, fixing "dsType is null" error on new JDBC tasks
- export resolveDatasource and ResolvedDatasource from datasource.ts
- adhocConfigs parsing moved into execute command scope (was missing)
- new JDBC tasks (no saved adhocConfigs) now work with:
  cz-cli task execute <task> --datasource <name|id> --database <db>

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Add Aurora MySQL (39), Aurora PostgreSQL (40), PolarDB PostgreSQL (48)
which are supported by JDBC tasks but were missing from the type map.
Also fix PolarDB (19) display name to "PolarDB MySQL" for clarity.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
@yunqiqiliang
yunqiqiliang merged commit 7b9df25 into main May 15, 2026
4 of 9 checks passed
hellozepp pushed a commit that referenced this pull request Jun 3, 2026
…er, #9 rerun -y

Co-Authored-By: cz-cli <noreply@clickzetta.com>
hellozepp pushed a commit that referenced this pull request Jul 23, 2026
…, one-step upload (#60)

* feat(analytics-agent): smoother table add, join notes, answer-builder --sql, one-step knowledge upload

Address v1.17.18 hands-on findings:

- domain table add: accept a fully-qualified `--table workspace.schema.table`
  and auto-split it, so lakehouse datasources no longer force trial-and-error
  --workspace/--schema. Surface the assigned dataset ID via ai_message and flag
  the soft-failure case where the backend returns success but did not attach
  the table (#1, #2, #6).
- domain join create/update: when the backend normalizes the relation by
  cardinality (e.g. n:1 -> 1:n), note it in ai_message so the direction change
  isn't mistaken for an error (#7).
- answer-builder create/update/validate: add `--sql` that injects into the
  content DSL's top-level sql field, so SQL quotes don't collide with the
  --content JSON escaping. Require at least one of --content/--sql (#9).
- knowledge file upload: document (examples + epilogue) that --target-path
  auto-creates the folder path and --domain-id binds at upload, collapsing the
  old create -> folder -> move -> bind sequence into one command (#3).

Not addressed (backend/doc): targetCounts.knowledge counting (#4), physical vs
v_gpt view column names (#5), bulk create APIs (#8).

Specs and tests updated alongside the code.

Co-Authored-By: cz-cli <noreply@clickzetta.com>

* fix(analytics-agent): set a display name when adding a table to a domain

A dataset created via `domain table add` had no display name, so it rendered
blank in the UI and broke page-level operations. Default displayName to the
fully-qualified physical table name (view name with the `v_gpt_` prefix
stripped), matching the UI convention, and add `--display-name` to override.

Verified live: adding a fresh dataset (createdDataset=true) now persists the
display name; when the backend reuses an existing dataset it keeps the prior
name, which is the intended backend behavior.

Co-Authored-By: cz-cli <noreply@clickzetta.com>

* feat(analytics-agent): add `table set-display-name` to rename an existing table

`domain table add --display-name` only sets the display name when the dataset
is newly created; the backend ignores it for an existing dataset. There was no
way to fix a blank/wrong display name on a table already in a domain.

Add `table set-display-name <dataset-id> --name`, using the dataset endpoints
the UI uses: read-modify-write against `GET /api/v1/dataset/detail` +
`POST /api/v1/dataset/update`, which require the full dataset object — fetch
it, change only displayName, post it back.

Verified live (reversibly) against Shanghai: renamed dataset 82's display name
and restored it; the other fields (description, schema, joins) are preserved.

Co-Authored-By: cz-cli <noreply@clickzetta.com>

* feat(analytics-agent): generalize table rename into `table update` (name + description)

The dataset/update endpoint sets both displayName and description in one call,
so replace the single-purpose `set-display-name` with `table update <dataset-id>
--name --description` (at least one required). Same read-modify-write against
dataset detail + update, now patching whichever fields the caller supplies.

Verified live (reversibly): updated dataset 82's display name and description
together, then restored both; other fields preserved.

Co-Authored-By: cz-cli <noreply@clickzetta.com>

* fix(analytics-agent): read table update source via dataset/list, not the broken dataset/detail

`dataset/detail?datasetId=<id>` returns CZD-20009 "dataset not found" for
datasets in some domains (the list endpoint sees them, detail does not — a
backend inconsistency the UI hits too). Switch `table update`'s read-modify-
write read step to `POST /api/v1/dataset/list {domainIds:[<id>]}`, locating the
full object by datasetId. Adds a required --domain-id.

Verified live: `table update 97 --domain-id 29` (a domain whose datasets fail
via dataset/detail) now renames successfully and restores; full object fields
preserved.

Co-Authored-By: cz-cli <noreply@clickzetta.com>

---------

Co-authored-by: cz-cli <noreply@clickzetta.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant