cz-cli Installation and Usage Guide
cz-cli is the command-line and AI Agent operational tool for Singdata Lakehouse. It encapsulates Lakehouse capabilities — connection configuration, SQL execution, Schema and table management, Studio task development, task execution inspection, Job diagnostics, and more — into stable CLI commands. Users can operate directly in the terminal, and AI Agents such as Codex, Claude Code, Cursor, Kiro, and Hermes can use natural language to assist with data warehouse development and operations.
With cz-cli, users can delegate tasks like "create a test data warehouse", "check why today's tasks failed", "backfill data for a time range", "query table schema and sample data" to cz-cli for execution; cz-cli performs the actual operations and returns structured results.
Target Users
- Data development, data platform, operations, and analytics teams who need to manage Singdata Lakehouse via the command line.
- Users who want to connect AI Agents to Singdata, enabling agents to execute queries, create tasks, diagnose runtime issues, and generate operational solutions.
- Teams needing to automate Singdata operations locally, in CI/CD, corporate bots, or operational dashboards.
Core Capabilities
| Capability | Description | Common Commands |
|---|---|---|
| Connection Management | Create and switch connection profiles for different environments (e.g., production, testing, UAT) | cz-cli profile create, cz-cli profile list, cz-cli profile use |
| SQL Queries | Execute SELECT, DDL, DML; supports sync wait and async Job | cz-cli sql, cz-cli job status, cz-cli job result |
| Schema & Table Management | View, create, describe, preview, and gather statistics on Schemas and tables | cz-cli schema, cz-cli table |
| Studio Tasks | Create SQL, offline integration, real-time sync, and other tasks; configure scheduling, publish online, and manually execute | cz-cli task |
| Run Inspection | View task execution records, logs, dependencies, statistics; retry on failure and backfill data | cz-cli runs, cz-cli attempts |
| Performance Diagnostics | View SQL Job status, results, and execution profile | cz-cli job, cz-cli sql --job-profile |
| AI Agent Integration | Enable Agents to invoke Singdata capabilities using natural language | cz-cli agent run, cz-cli ai-guide |
| Data Source Management | Manage external data sources, preparing for sync and import tasks | cz-cli datasource |
Prerequisites
Before installation, confirm you have the following information. Refer to the documentation if unsure:
| Item | Description | Example |
|---|---|---|
| Service Endpoint | Singdata API service address | cn-shanghai-alicloud.api.clickzetta.com |
| Instance Name | Singdata instance name or ID | demo_instance |
| Workspace | Workspace name | analytics_prod |
| Username & Password | Account credentials for connecting to Singdata | data_user |
| Default Schema | Schema to use after login | public |
| Default Compute Group | Virtual Cluster used for SQL execution or tasks | DEFAULT |
If using a Personal Access Token (PAT), you can replace username and password with the PAT.
Installing cz-cli
macOS / Linux
Recommended: install via npm:
Alternatively, use the one-line install script:
After installation, reload your Shell configuration:
zsh Users
bash Users
Windows
Method 1: Install via npm.
If Node.js and npm are already installed on your machine, install the npm package directly:
Method 2: Download the installer package.
- Open GitHub Releases: https://github.com/clickzetta/cz-cli/releases
- Download the Windows archive, e.g., cz-cli-windows-x64.zip.
- Extract and add the directory containing cz-cli.exe to your system PATH.
- Re-open PowerShell or CMD.
Verify Installation
Seeing a version number indicates a successful installation.
You can also check the help:
Configuring Connection Profiles
A Profile is a local configuration that stores connection information for cz-cli. We recommend creating a separate profile for each environment, e.g., prod, uat, dev.
Create with Username and Password
Example:
Create from JDBC Connection String
If you already have a JDBC connection string, you can create a profile directly:
Create with CLI Credential
How to Obtain a PAT
1) Log in to your Singdata account, and select LakehouseMCP from the left menu.

2) If you have not created a PAT, please create one first.

3) After creation, switch to the CLI tab and copy your CLI connection string.

4) If you already have a PAT, paste your PAT into the popup window for CLI creation, then click the "Generate Connection String" button.

Once you have copied the CLI connection string, return to the cz-cli window, insert the connection string into the following command, and execute:
Once execution completes, the profile configuration is done.
Viewing and Switching Profiles
View profiles configured on this machine
Set the default profile
Temporarily use a specific profile for a command
Verify connection
If connected is true in the result, the connection is successful.
First-Time Usage
View the current workspace
View Schemas
Execute a read-only query
cz-cli sql defaults to asynchronous submission, suitable for long-running queries; add --sync if you want the command to wait and return results directly.
You can also pass SQL using -e:
Execute write operations
To prevent accidental operations, write operations such as INSERT, UPDATE, DELETE, CREATE, DROP require explicitly adding --write.
View table structure and sample data
Studio Task Development and Operations
cz-cli can operate tasks in Singdata Studio, suitable for data development and daily operations.
Create a SQL Task
Save Task SQL
Configure Scheduling
The following example schedules execution daily at 02:00:
Deploy Task
Manually Execute Task
Viewing Execution Records and Logs
View Recent Runs
View Run Details
View Run Logs
Wait for a Run to Complete
Using with AI Agents
A key value of cz-cli is giving AI Agents a controllable, auditable entry point for operating Singdata. Users can have Agents invoke cz-cli via command line within tools such as Codex, Claude Code, Cursor, Kiro, and Hermes.
Recommended Agent Prompt
Share the following prompt with your AI Agent:
Common Natural Language Requests
In the examples below, <profile>, <task_name>, and <job_id> should be replaced with the user's own connection profile, task name, and Job ID. It is recommended to have the Agent first execute cz-cli -p <profile> status to confirm the connection is available.
Executing via cz-cli's Built-in Agent Entry Point
If the current environment already has the LLM parameters configured for the cz-cli Agent, you can also run directly:
To generate command descriptions for external Agents:
Using in Enterprise Bot Scenarios
If you use enterprise bots such as Hermes to host AI Agents, we recommend installing cz-cli in the bot execution environment and adopting the following strategies:
- Grant the bot only the necessary Singdata permissions; avoid using high-privilege administrator accounts.
- Enable manual confirmation for write, delete, deploy, decommission, backfill, and similar operations.
- Implement whitelisting or approval controls for users who can access the bot.
- Store credentials such as profiles, PATs, and passwords in controlled environment variables or local configuration — never in public documentation, chat history, or code repositories.
Output Formats and Automation
cz-cli outputs JSON by default, making it easy for AI Agents and scripts to parse. Other formats can also be specified:
Table format, suitable for human reading
CSV format, suitable for export
Extract a single field
In CI/CD or automation scripts, we recommend:
- Using fixed profile names, e.g., prod-readonly, uat-admin.
- Using --sync and --timeout for query commands to control wait time.
- Explicitly adding --write for write operations, with approval or manual confirmation retained in the workflow.
- Prioritizing JSON output to avoid parsing natural language text.
Upgrading
Check the current version:
Upgrade to the latest version:
If installed via npm:
FAQ
Q: After installation, I get "cz-cli: command not found"?
Usually the PATH has not taken effect. Reload your Shell configuration:
Or manually add to PATH:
Q: The status command shows connected: false?
Check the following in order:
Verify that the service, instance, workspace, username, and password or PAT in the profile are correct. If your Lakehouse instance has network policies configured, confirm that your machine's network can access the Lakehouse service.
Q: How do I modify fields in a profile?
The profile configuration file is located at the .clickzetta/profiles.toml path under your current user directory.
You can modify it using the profile update command:
Q: Queries succeed, but task-related commands fail?
Commands like task, runs, and attempts depend on Studio capabilities. Verify that the environment corresponding to the current profile has Studio task capabilities enabled, and that the account has permissions to view or manage tasks.
Q: CREATE TABLE or INSERT is rejected?
Write operations require adding --write:
Q: SQL returns a job_id but no data directly?
This is because execution defaults to asynchronous mode. To get query results returned directly, add --sync:
If you already have a job_id, you can continue with:
Q: How can I reduce the risk of misoperations?
- Queries, inspections, and diagnostics can be executed by the Agent directly.
- For write, delete, task deploy, task decommission, backfill, and retry-on-failure actions, we recommend requiring the Agent to first present a plan and wait for manual confirmation.
- Configure a separate low-privilege account or read-only profile for the Agent.
- Use explicit profile names for production environments, e.g., prod-readonly, prod-operator.
Recommended Getting Started Path
- Install cz-cli and verify that cz-cli --version works.
- Create a profile and verify the connection with cz-cli -p <profile> status.
- Use schema list, table list, and sql --sync to complete a read-only query.
- In a test environment, try creating a table or inserting data to become familiar with the --write protection mechanism.
- Review task --help and runs --help to understand task development and operations commands.
- Hand cz-cli over to your AI Agent, with an agreement that high-risk operations require manual confirmation.
For concepts such as account name (account_name) and service name (instance_name) and how to find them, see: https://www.singdata.com/documents/key-concepts
