Hologres AI Plugins consists of two components: the Hologres CLI command line tool and the Hologres Agent Skills package set. The CLI provides 60+ commands that cover instance connectivity, table and dynamic table management, SQL execution, data import and export, GUC tuning, Volume storage, and AI content generation. Agent Skills integrates with mainstream AI coding tools such as Claude Code, Cursor, and Codex, so the agent can call the CLI directly to perform query optimization, slow query diagnosis, schema design, and more. This topic describes how to install, configure, and use the CLI and Agent Skills.
Overview
The Hologres CLI is a command line tool for the Hologres real-time data warehouse. It exposes instance management, SQL execution, schema operations, data import and export, dynamic table lifecycle management, and AI content generation as discrete commands. Every command emits structured output (JSON, table, CSV, or JSONL), so it works equally well for human operators and for automated agents.
Hologres Agent Skills is a collection of skill packages that plug into mainstream AI coding tools. After you install the skills, agents in Claude Code, Cursor, Codex, and similar tools can read the best practices encoded in the skill packages and call the Hologres CLI on your behalf to handle tasks such as query optimization, schema design, slow query diagnosis, and unique visitor (UV) analytics.
Scenarios
-
Manage tables, dynamic tables, schemas, and permissions in bulk from the terminal or a shell script, instead of clicking through the console.
-
Run data imports, dynamic table refreshes, and schema changes inside CI/CD pipelines, and feed the JSON output into your monitoring stack.
-
Drive Hologres from natural language inside Claude Code, Cursor, or another AI coding tool to optimize SQL, analyze slow queries, or design UV deduplication solutions.
-
Generate text, images, and video through Hologres AI functions and write the output directly to an Object Storage Service (OSS) bucket through a Hologres Volume.
Comparison with other tools
|
Tool |
Purpose |
When to use |
|
Hologres console |
Graphical operations portal |
One-off manual operations, monitoring dashboards, and instance provisioning |
|
psql or another PostgreSQL client |
Native SQL shell |
Interactive data exploration and ad-hoc SQL debugging |
|
Hologres CLI |
Command line management with built-in safety guardrails and structured output |
Scripted operations, batch management, agent automation, and CI/CD integration |
|
Hologres Agent Skills |
AI tool extension layered on top of the CLI |
Driving the CLI through natural language inside an AI coding tool |
Prerequisites
Prepare the following resources and permissions before you use the Hologres CLI or Agent Skills.
|
Resource |
Requirement |
Required |
|
Hologres instance |
An instance in running state. Basic commands require Hologres V2.2 or later. Full dynamic table lifecycle management (V3.1 upgrade, serverless compute, and so on) requires Hologres V3.1 or later. |
Yes |
|
Database account |
A database account (username and password) on the target instance, or a Resource Access Management (RAM) user AccessKey pair that has Hologres permissions on the instance. |
Yes |
|
Network connectivity |
The host that runs the CLI must reach the instance endpoint. Choose |
Yes |
|
Python runtime |
Python 3.11 or later. |
Yes |
|
Operating system |
Linux, macOS, or Windows. |
Yes |
|
RAM role |
For AI content generation, create a RAM role that the Hologres service can assume (we recommend the prebuilt |
Required for AI features |
|
OSS bucket |
For AI content generation, prepare an OSS bucket as the storage backend for the Volume. Generated images, videos, and files land in this bucket. |
Required for AI features |
|
Foundation model API key |
For AI content generation, prepare an API key for each foundation model you plan to use, such as a key for Alibaba Cloud Model Studio or Tongyi Qianwen. |
Required for AI features |
We recommend uv as the Python package manager. Compared with pip, uv installs faster and provides cleaner dependency isolation.
Install the Hologres CLI
Three installation methods are available. Choose the one that matches your environment.
|
Method |
Description |
When to use |
|
One-click install script (recommended) |
Detects the Python environment, installs uv, configures PATH, and installs the CLI in one step. |
First-time users, or anyone unfamiliar with Python tooling |
|
pip install |
Installs into an existing Python environment using pip. |
Existing Python projects and CI/CD images |
|
uv install |
Installs globally with |
Local workstations that share the CLI across multiple projects |
Method 1: One-click install script (recommended)
Run the following command to install the CLI:
curl -sSf https://raw.githubusercontent.com/aliyun/hologres-ai-plugins/master/hologres-cli/install.sh | sh
After installation, reload the shell so that the updated PATH takes effect:
source ~/.bashrc # bash users
source ~/.zshrc # zsh users
Method 2: pip install
In a Python 3.11 or later environment, run:
pip install hologres-cli
Method 3: uv install
Use uv tool to install the CLI globally, isolated from any project's dependencies:
uv tool install hologres-cli
Verify the installation
Print the CLI version. A version string indicates that the installation succeeded.
hologres --version
Configure the connection
The CLI organizes connections as profiles. Each profile holds the full set of parameters needed to reach a Hologres instance, including instance ID, network type, authentication method, and database. Profiles let you switch between development, staging, and production environments without editing files by hand.
Run the interactive configuration wizard
For first-time setup, start the wizard:
hologres config
The wizard prompts for the following nine fields in order:
-
Profile name: An identifier for this connection set, such as
default,dev, orprod. Allowed characters are letters, digits, underscores, and hyphens. Names are case-sensitive, and a duplicate name overwrites the existing profile. -
Region: The region ID of the instance, such as
cn-hangzhou,cn-shanghai, orcn-beijing. -
Instance ID: The Hologres instance ID, formatted as
hgprecn-cn-xxx. You can find it on the instance details page in the Hologres console. -
Network type:
internet(public network),intranet(classic network), orvpc(VPC). For details, see the network type selection table later in this section. -
Authentication method:
basic(database username and password) orram(RAM user AccessKey pair). -
Database name: The database to connect to inside the instance.
-
Warehouse: The compute warehouse to use.
-
Endpoint: Optional. If you leave it empty, the CLI builds the endpoint from the instance ID, region, and network type. For details, see Endpoint format later in this section.
-
Port: Defaults to 80, which is the PG Wire protocol port for Hologres. The same port applies in both VPC and public network deployments. To use SSL or TLS, declare it explicitly in the endpoint or in a dedicated parameter, as described in the Hologres connection documentation.
The wizard saves the profile to ~/.hologres/config.json. Run a status check to confirm the configuration:
hologres status
The password and AccessKey are encrypted with the Fernet algorithm before they are written to ~/.hologres/config.json. The encryption key lives in ~/.hologres/.cipher_key with file permissions set to 0600, so only the current user can read or write it. Do not edit either file by hand, and treat both files with the same care you give to your personal credentials.
Choose a network type
The network type determines how the CLI builds the endpoint and routes traffic. Choosing the wrong type results in connection timeouts or DNS failures. Use the following table to make the correct choice:
|
Network type |
Environment |
Notes |
|
internet |
Local laptops, office networks, and home networks that cannot reach the Alibaba Cloud private network. |
Enable the public endpoint in the Hologres console and add the client's IP address to the instance allowlist. |
|
vpc (recommended for private networks) |
ECS hosts, Container Service nodes, Function Compute, DataWorks, and other resources inside an Alibaba Cloud VPC. |
The default choice for cloud-resident clients. The client must be in the same VPC as the Hologres instance, or the two VPCs must be connected. |
|
intranet |
ECS hosts on the legacy classic network. This option is rarely used today. |
Reserved for legacy classic network deployments. For new projects, use vpc instead. |
Manage profiles
Use the following commands to view, switch, and update profiles:
# List all profiles
hologres config list
# Show details of the current profile
hologres config show
# Switch to another profile
hologres config switch prod
# Set a configuration value directly
hologres config set database my_new_db
hologres config set warehouse my_warehouse
# Read a single configuration value
hologres config get database
# Delete a profile
hologres config delete old_profile --confirm
Switch environments per command
To run a single command against a different environment without changing the default profile, pass the --profile flag. This is useful in scripts that operate on multiple environments side by side:
hologres --profile dev status
hologres --profile staging sql run "SELECT 1"
hologres --profile prod schema tables
Endpoint format
When the endpoint field is empty, the CLI assembles the host from instance_id, region_id, and the network type:
|
Network type |
Host format |
|
internet |
|
|
intranet |
|
|
vpc |
|
CLI basics
Check the connection status
Verify that the current profile can reach Hologres:
hologres status
A successful response looks similar to:
{
"ok": true,
"data": {
"connected": true,
"version": "Hologres 2.2.0.x",
"database": "my_db"
}
}
When the connection fails, ok is false, and the response carries the CONNECTION_ERROR error code along with a description. Use the description to troubleshoot network, allowlist, or authentication issues.
Choose an output format
The CLI supports four output formats. Use the global -f flag to pick one. The default is JSON:
hologres -f json schema tables # JSON, the default, ideal for agents and scripts
hologres -f table schema tables # Terminal table, ideal for human review
hologres -f csv schema tables # CSV, ideal for downstream processing
hologres -f jsonl schema tables # JSON Lines, ideal for stream processing
Inspect the instance and warehouses
hologres instance # Show the version and max connections of the instance bound to the current profile
hologres warehouse # List all warehouses
hologres warehouse default_warehouse # Show details of a specific warehouse
View command history
hologres history # Show recent commands
hologres history -n 50 # Show the last 50 commands
Manage tables
The hologres table command family covers listing, inspecting, creating, altering, dropping, truncating, and partition management.
List tables
hologres table list # List all tables in the current database
hologres table list --schema public # List tables under a specific schema
hologres table list -f table # Output as a terminal table
A typical JSON response:
{
"ok": true,
"data": [
{"schema": "public", "name": "orders", "type": "table"},
{"schema": "public", "name": "users", "type": "table"}
]
}
Inspect a table
hologres table show public.orders # Columns, types, primary key, and comments
hologres table properties public.orders # Storage format, distribution key, TTL
hologres table dump public.orders # Full DDL
hologres table size public.orders # Storage size
Create a table
Create a column-oriented table:
hologres table create --name public.orders \
--columns "order_id BIGINT NOT NULL, user_id INT, amount DECIMAL(10,2), created_at TIMESTAMPTZ" \
--primary-key order_id \
--orientation column \
--distribution-key order_id \
--clustering-key "created_at:asc" \
--ttl 7776000 \
--dry-run
Create a logical partitioned table (V3.1 or later):
hologres table create --name public.logs \
--columns "a TEXT, b INT, ds DATE NOT NULL" \
--primary-key "b,ds" \
--partition-by ds \
--partition-mode logical \
--orientation column \
--distribution-key b \
--partition-expiration-time "30 day" \
--dry-run
--dry-run only previews the generated SQL; it does not execute. After you confirm that the SQL is correct, remove the flag to actually create the table.
Alter a table
hologres table alter my_table --add-column "age INT"
hologres table alter my_table --rename-column "old_col:new_col"
hologres table alter my_table --ttl 3600
hologres table alter my_table --dictionary-encoding-columns "a:on,b:auto"
hologres table alter my_table --partition-expiration-time "60 day"
hologres table alter my_table --ttl 3600 --dry-run # Preview the generated SQL
Drop or truncate a table
hologres table drop my_table # Preview only (default dry-run)
hologres table drop my_table --confirm # Actually drop the table
hologres table truncate my_table --confirm # Empty the table but keep its schema
Manage partitions
hologres partition list --table my_table
hologres partition drop --table my_table --partition "2025-04-01" --confirm
hologres partition alter -t my_table --partition "ds=2025-03-16" --set "keep_alive=TRUE"
Manage views
hologres view list
hologres view show analytics.daily_stats
Manage dynamic tables
A dynamic table lets you declare a result set with SQL and have Hologres refresh it automatically at a chosen freshness interval. Dynamic tables are a core capability of the Hologres real-time data warehouse. The hologres dt command family provides full lifecycle management for dynamic tables on V3.1 or later.
Create a dynamic table
Basic example:
hologres dt create -t my_dt \
--freshness "10 minutes" \
-q "SELECT col1, SUM(col2) FROM src GROUP BY col1"
Use incremental refresh and serverless compute:
hologres dt create -t ads_report \
--freshness "5 minutes" \
--refresh-mode incremental \
--computing-resource serverless \
-q "SELECT region, SUM(amount) FROM orders GROUP BY region"
Preview the generated SQL only:
hologres dt create -t my_dt --freshness "10 minutes" -q "SELECT 1" --dry-run
Inspect dynamic tables
hologres dt list # List all dynamic tables
hologres dt show public.my_dt # Properties and refresh status
hologres dt ddl public.my_dt # Export the DDL
hologres dt lineage public.my_dt # Show lineage dependencies
hologres dt storage public.my_dt # Storage size
hologres dt state-size public.my_dt # State table size
Alter, refresh, or drop a dynamic table
hologres dt alter my_dt --freshness "30 minutes"
hologres dt refresh my_dt
hologres dt drop my_dt # Preview only
hologres dt drop my_dt --confirm # Actually drop
Upgrade from V3.0 to V3.1
Convert dynamic tables that were created on V3.0 to the V3.1 format:
hologres dt convert my_old_dt # Convert a single dynamic table
hologres dt convert --all # Batch-convert every V3.0 dynamic table in the current database
Run SQL and analyze queries
Read-only queries
hologres sql run "SELECT * FROM orders LIMIT 10"
hologres sql run --with-schema "SELECT * FROM orders LIMIT 10" # Include column names and types
hologres sql run --no-limit-check "SELECT * FROM large_table" # Disable the row count check
By default, a SELECT statement without a LIMIT clause is blocked when it returns more than 100 rows. For details, see the row count limit description in the Security guardrails section. To bypass this check, pass --no-limit-check.
Write operations
Write SQL statements require the explicit --write flag:
hologres sql run --write "INSERT INTO logs VALUES (1, 'test')"
hologres sql run --write "DELETE FROM logs WHERE created_at < '2024-01-01'"
DELETE and UPDATE statements without a WHERE clause are blocked unconditionally with the DANGEROUS_WRITE_BLOCKED error. --write does not bypass this guard. You must add an explicit filter and rerun the command.
View the execution plan
hologres sql explain "SELECT * FROM orders WHERE status = 'active'"
Import and export data
The hologres data command family moves rows between local files and Hologres tables, and provides a row count helper:
# Export
hologres data export my_table -f output.csv
hologres data export -q "SELECT * FROM users WHERE active=true" -f users.csv
# Import
hologres data import my_table -f input.csv
hologres data import my_table -f input.csv --truncate # Truncate the target table first
# Row count
hologres data count my_table
hologres data count my_table --where "status='active'"
data import and data export are not subject to the 100-row SELECT check. They handle large tables directly.
Manage GUC parameters
Use the hologres guc command family to view, change, and reset Hologres Grand Unified Configuration (GUC) parameters at the database level:
hologres guc show statement_timeout # Show the current value of a parameter
hologres guc list # List common parameters
hologres guc list --filter timeout # Filter parameters by keyword
hologres guc set statement_timeout '5min' # Database-level setting (runs ALTER DATABASE)
hologres guc reset statement_timeout # Reset to the default value
guc set is equivalent to running ALTER DATABASE ... SET ... and only takes effect for new connections to that database. To set a parameter for the current session, use hologres sql run "SET param = value".
Generate AI content
The CLI integrates the Hologres AI functions, which generate and edit text, images, and video. Image and video output goes to a Volume by default, and the OSS bucket attached to the Volume holds the actual files.
Prerequisites for AI features
Complete both of the following steps before you call any AI command:
-
Register a foundation model: Use
hologres model createto register the model you plan to use (such as Tongyi Qianwen or Tongyi Wanxiang) in the Hologres instance, providing the model type, name, and API key. For details, see the Manage foundation models section. -
Configure a Volume: Use
hologres volume createto register a Volume in Hologres that maps to an OSS bucket. The Volume becomes the storage destination for generated content. For details, see Manage Volume storage.
When you create a Volume, we recommend using a RAM role (RoleArn) to authorize OSS access. If you must use an AccessKey pair, pass it through environment variables instead of writing it on the command line:
# Authorize through a RAM role (recommended)
hologres volume create my_vol \
--endpoint oss-cn-hangzhou-internal.aliyuncs.com \
--root oss://my-bucket/ai-output/ \
--rolearn acs:ram::123456:role/AliyunHologresDefaultRole
# Or, if you must use an AccessKey pair, pass it via environment variables
export HOLO_AK="$(security find-generic-password -s holo_ak -w)"
export HOLO_SK="$(security find-generic-password -s holo_sk -w)"
hologres volume create my_vol \
--endpoint oss-cn-hangzhou-internal.aliyuncs.com \
--root oss://my-bucket/ai-output/ \
--access-key "$HOLO_AK" \
--access-secret "$HOLO_SK"
Never put a real AccessKey ID or AccessKey Secret on the command line. Command line arguments are recorded by the shell history, the process list, and CI logs. In production, authorize OSS access with a RAM role (RoleArn). If you must use an AccessKey pair, inject it through environment variables, Key Management Service (KMS), or a Security Token Service (STS) token.
Generate text
hologres ai gen "Introduce the core advantages of Hologres"
hologres ai gen "Write a poem about data" --model qwen-max
Generate images
hologres ai image-gen "Tech-style data warehouse concept art" -o volume://my_vol/images
hologres ai image-gen "Product showcase" --size "1280*720" -n 2 -o volume://my_vol/output
hologres ai image-gen "Q-style cartoon" --reference-url volume://my_vol/ref.png -o volume://my_vol/output
Generate and edit video
# Text to video
hologres ai t2v "A cat running across a meadow" -o volume://my_vol/output
# Image to video
hologres ai i2v "Animate this image" --img-url volume://my_vol/frame.png -o volume://my_vol/output
# Reference image to video
hologres ai r2v "A woman strolling through a garden" --reference-url volume://my_vol/girl.png -o volume://my_vol/output
# Edit video
hologres ai video-edit "Convert to anime style" --video volume://my_vol/input.mp4 -o volume://my_vol/output
Manage foundation models
The model command family registers, lists, and removes foundation models in a Hologres instance. Models registered here can be invoked from the ai command family for text, image, and video generation.
# List all supported models
hologres model catalog [--task T] [--search S]
# List models registered in Hologres
hologres model list [--task T] [--model-type T] [--search S]
# Register a supported model in Hologres
hologres model create --name N --type T --api-key K [--config J] [--dry-run]
# Delete a registered model from Hologres
hologres model delete <model_name> [--confirm]
Manage Volume storage
A Volume is a logical mapping from Hologres to external object storage in OSS. Each Volume points at a prefix inside an OSS bucket, and both Hologres SQL functions (such as the AI generation functions) and the CLI use it. The relationship between a Volume and OSS works as follows:
-
A Volume holds either a
RoleArnor an AccessKey pair as its credential for OSS. The Hologres service assumes the role to perform OSS operations on your behalf. -
The
RoleArncomes from a role you create in the RAM console. We recommend the prebuiltAliyunHologresDefaultRole. Its policy must grantoss:GetObject,oss:PutObject, andoss:ListObjectson the target bucket. -
hologres volume deleteonly removes the Volume registration on the Hologres side; it does not delete files in the OSS bucket. To delete the actual data, runhologres volume delete-filefirst, or clean the bucket from the OSS console.
Common commands
hologres volume list # List all Volumes
hologres volume list-files --volume my_vol # List files in a Volume
hologres volume list-files --volume my_vol --prefix images/ --max-count 50
hologres volume upload-file --volume my_vol --local-file ./data.csv --target-file data/data.csv
hologres volume download-file --volume my_vol --file report.csv -d ./output
hologres volume view volume://my_vol/images/photo.png # Preview a file in the terminal
hologres volume delete-file --volume my_vol --file old.csv --confirm
hologres volume delete my_vol # Delete the Volume registration (does not delete OSS data)
Network type for Volume traffic
Volume operations run over either the public network or the private network. Use the --net flag to choose:
hologres volume list-files --volume my_vol --net internet # Public network (default)
hologres volume list-files --volume my_vol --net intranet # Private network (recommended for ECS and VPC clients)
Security guardrails
The Hologres CLI ships with six layers of safety guardrails, automatic masking for sensitive data, and credential encryption. Together they protect every step of the path from SQL input to result output.
Layer 1: Row count limit
A SELECT statement without a LIMIT clause returns at most 100 rows by default. Anything beyond that triggers the LIMIT_REQUIRED error. The limit prevents accidental retrieval of huge result sets.
The 100-row cap is the CLI's built-in default. To bypass it, pass --no-limit-check. Bulk commands such as data export and data import are exempt from this check.
Layer 2: Read-only connections
Every connection runs SET default_transaction_read_only = ON by default, so the database engine rejects writes at the transaction level. Even if a SQL statement carries write semantics by mistake, it cannot reach storage.
Layer 3: Explicit authorization for write operations
Write operations require explicit authorization:
|
Authorization |
Example |
|
|
|
|
|
|
|
Omitting |
|
|
Inherently write commands |
|
A write that is not explicitly authorized fails with WRITE_GUARD_ERROR.
Layer 4: Block dangerous operations
A DELETE or UPDATE without a WHERE clause is rejected with DANGEROUS_WRITE_BLOCKED. --write does not bypass this guard. Add an explicit filter and rerun the statement.
Layer 5: Serverless compute isolation
SQL submitted by an agent is routed to a dedicated serverless compute pool, isolated from the dedicated compute resources that serve production. Exploratory AI queries cannot interfere with online workloads.
Layer 6: Adaptive execution
Complex SQL is scheduled in stages by the adaptive execution engine, which scales compute resources on demand and prevents a single query from triggering an out-of-memory (OOM) failure.
Automatic masking for sensitive data
The CLI masks columns whose names match the following sensitive fields in the result set:
|
Field |
Masked output |
|
phone |
|
|
|
|
|
password |
|
|
id_card |
|
To disable masking, for example during compliance-approved operational tasks that require the raw values, add --no-mask:
hologres sql run --no-mask "SELECT * FROM users LIMIT 10"
Credential encryption
The CLI encrypts the database password and any AccessKey with the Fernet algorithm before writing them to ~/.hologres/config.json. The encryption key is stored in ~/.hologres/.cipher_key with file permissions 0600. Older plaintext configurations remain readable, and the CLI rewrites them in the encrypted format on the next save.
Error codes
|
Error code |
Meaning |
|
|
Failed to connect to the instance. |
|
|
A |
|
|
A write operation is not explicitly authorized. |
|
|
A dangerous write operation is blocked. |
|
|
The target resource does not exist. |
|
|
The input is invalid. |
|
|
The OSS operation failed. |
Install Agent Skills
Agent Skills are skill packages bundled for the major AI coding tools. After you install a package, the agent reads its prompt templates and best practices and then calls the Hologres CLI to handle database tasks for you.
Installation methods
The recommended path is the one-click install script, which downloads the packages, installs the dependencies, and starts the interactive selector:
curl -sSf https://raw.githubusercontent.com/aliyun/hologres-ai-plugins/master/agent-skills/install.sh | sh
Alternatively, run the installer directly with uvx (no prior installation required):
uvx hologres-agent-skills
Interactive installation flow
After the install script starts, the interactive selector walks you through three steps:
-
Choose the AI tool: Select your tool from the list of Claude Code, Cursor, OpenAI Codex, GitHub Copilot, Qoder, Trae, OpenClaw, and OpenCode. Use the up and down arrow keys to move the cursor, then press Enter to confirm.
-
Choose the skill packages: A multi-select prompt opens. Press Space to toggle a package, use the arrow keys to move, and press Enter to continue. To go back, press Esc.
-
Deploy: The script copies the selected packages into the AI tool's local directory. Once deployment finishes, the script prints the install path and version of every skill.
Sample interactive flow:
? Choose an AI tool (use ↑/↓ keys, press Enter to confirm):
❯ Claude Code
Cursor
OpenAI Codex
GitHub Copilot
Qoder
Trae
OpenClaw
OpenCode
? Choose the skills to install (Space to toggle, Enter to confirm):
[x] hologres-cli
[x] hologres-query-optimizer
[ ] hologres-slow-query-analysis
[x] hologres-schema-generator
[ ] hologres-privileges
[ ] hologres-uv-compute
[ ] hologres-bsi-profile-analysis
[ ] hologres-ad-campaign
✔ Deployment complete
hologres-cli → ~/project/.claude/skills/hologres-cli
hologres-query-optimizer → ~/project/.claude/skills/hologres-query-optimizer
hologres-schema-generator → ~/project/.claude/skills/hologres-schema-generator
Install paths
Default skill install paths for each AI tool:
|
AI tool |
Path |
|
Claude Code |
|
|
Cursor |
|
|
OpenAI Codex |
|
|
GitHub Copilot |
|
|
Qoder |
|
|
Trae |
|
|
OpenClaw |
|
|
OpenCode |
|
Built-in skill packages
|
Skill |
Capability |
|
hologres-cli |
CLI usage guide that covers correct usage of 60+ commands. |
|
hologres-query-optimizer |
Execution plan analysis and bottleneck diagnosis. |
|
hologres-slow-query-analysis |
Slow query diagnosis based on the |
|
hologres-schema-generator |
Schema design (storage format, indexes, and partitions). |
|
hologres-privileges |
Permission management (GRANT, REVOKE, and roles). |
|
hologres-uv-compute |
UV and PV deduplication using RoaringBitmap. |
|
hologres-bsi-profile-analysis |
Bit Sliced Index (BSI) profile analytics, such as audience selection, GMV, and TopK. |
|
hologres-ad-campaign |
End-to-end AI-generated content (AIGC) ad campaign workflow. |
Agent Skills scenarios
The scenarios below show how an agent calls a skill from inside an AI coding tool. The examples use Claude Code; the experience in other AI tools is similar.
Scenario 1: Optimize a slow query
Send a natural language request to Claude Code. The agent calls the query-optimizer skill, runs the execution plan, and returns optimization advice:
User: This SQL ran for 30 seconds. Help me optimize it:
SELECT region, SUM(amount)
FROM orders
WHERE created_at > '2025-01-01'
GROUP BY region;
Agent runs:
$ hologres sql explain "SELECT region, SUM(amount) FROM orders \
WHERE created_at > '2025-01-01' GROUP BY region"
CLI returns (excerpt):
Seq Scan on orders (cost=0..120000 rows=10000000)
Filter: (created_at > '2025-01-01')
Redistribution: HashRedistribution by region
Agent summary:
Bottleneck 1: Seq Scan over the full table; no efficient filter on created_at
Bottleneck 2: Heavy data redistribution by region
Recommendations:
1. Set created_at as the clustering key:
ALTER TABLE orders SET clustering_key='created_at:asc'
2. Set region as the distribution key to remove the GROUP BY redistribution:
ALTER TABLE orders SET distribution_key='region'
3. Enable result cache: hologres guc set hg_cache_enable on
Scenario 2: Investigate slow queries
User: Production looks slow. Please investigate.
Agent runs (slow-query-analysis skill):
1. hologres sql run "SELECT query, duration, start_time FROM hg_query_log
WHERE start_time > NOW() - INTERVAL '10 minutes'
ORDER BY duration DESC LIMIT 10"
2. Identify the slowest SQL.
3. hologres sql explain "<slowest SQL>"
4. Output the execution plan analysis and an optimization plan.
Scenario 3: Design a schema
User: Design a table for orders that grows by 100 million rows per day.
Agent runs (schema-generator skill):
1. Asks about query patterns: high-frequency lookups by user_id and daily aggregates.
2. Recommends columnar storage, daily logical partitioning, user_id as the distribution key, and created_at as the clustering key.
3. hologres table create --name public.orders \
--columns "order_id BIGINT NOT NULL, user_id INT, amount DECIMAL(10,2), created_at TIMESTAMPTZ, ds DATE NOT NULL" \
--primary-key "order_id,ds" \
--partition-by ds --partition-mode logical \
--orientation column \
--distribution-key user_id \
--clustering-key "created_at:asc" \
--partition-expiration-time "180 day" \
--dry-run
4. Outputs the DDL with reasoning. After you confirm, drop --dry-run to actually create the table.
Scenario 4: Real-time UV deduplication
User: We have 500 million users. Design a real-time UV count per channel.
Agent runs (uv-compute skill):
1. Recommends a RoaringBitmap and dynamic table architecture.
2. Creates a user dictionary encoding table and a per-channel bitmap table.
3. Uses a dynamic table to incrementally refresh the bitmaps per channel.
4. Queries with RB_CARDINALITY to return UV counts in subseconds.
FAQ
The shell reports "command not found" when I run hologres. How do I fix it?
The CLI install directory is not in PATH. Reload the shell configuration:
source ~/.bashrc # or source ~/.zshrc
If the command is still missing, add the default uv install directory to PATH manually:
export PATH="$HOME/.local/bin:$PATH"
The connection fails. How do I troubleshoot?
Inspect the current configuration and connection state first:
hologres config show # Show details of the current profile
hologres status # Test the connection and show the error message
hologres config # Restart the wizard to update the configuration
Then verify the four most common culprits:
-
The network type matches the runtime environment (internet for local hosts, vpc for hosts inside an Alibaba Cloud VPC).
-
The instance ID and region are correct.
-
The credentials (username and password, or the AccessKey pair) have access to the target instance.
-
For public network access, the client IP address is on the instance allowlist.
The CLI rejects my write operation. How do I unblock it?
Handle the error code based on which guard fired:
# WRITE_GUARD_ERROR: write not authorized; add --write
hologres sql run --write "INSERT INTO logs VALUES (1, 'test')"
# DANGEROUS_WRITE_BLOCKED: DELETE or UPDATE without WHERE; add a filter
hologres sql run --write "DELETE FROM users WHERE id = 1"
A SELECT statement returns LIMIT_REQUIRED. What should I do?
A SELECT without a LIMIT clause returns at most 100 rows. Choose one of the following:
hologres sql run "SELECT * FROM table LIMIT 100" # Add an explicit LIMIT
hologres sql run --no-limit-check "SELECT * FROM table" # Disable the row count check
I forgot the database password. What now?
The CLI does not store the password in plaintext. Run the wizard again and enter the new value:
hologres config
How do I upgrade the CLI and Skills to the latest version?
pip install --upgrade hologres-cli # Upgrade the CLI
uvx hologres-agent-skills # Restart the Skills installer to overwrite
Command reference
Common commands grouped by family:
|
Family |
Subcommands |
Description |
|
|
list / show / switch / set / get / delete |
Profile management |
|
|
list / create / show / dump / size / properties / alter / drop / truncate |
Table management |
|
|
list / show |
View management |
|
|
list / create / alter / drop |
Partition management |
|
|
create / list / show / ddl / lineage / storage / state-size / refresh / alter / drop / convert |
Dynamic table management |
|
|
run / explain |
SQL execution and execution plan |
|
|
export / import / count |
Data import, export, and row count |
|
|
show / set / reset / list |
GUC parameter management |
|
|
list / create |
Extension management |
|
|
gen / image-gen / t2v / i2v / r2v / video-edit |
AI content generation |
|
|
create / list / delete / list-files / delete-file / download-file / upload-file / view |
Volume storage management |
|
|
catalog / list / create / delete |
Foundation model management |
|
General |
status / instance / warehouse / history / ai-guide |
Connection state, instance, warehouse, command history, and AI usage guide |
Related links
-
Project repository and source code: https://github.com/aliyun/hologres-ai-plugins
-
License: Apache License 2.0
-
uv Python package manager: https://github.com/astral-sh/uv