Loading...
Loading...
Assists with SAP HANA Developer CLI (hana-cli) for database development and administration. Use when: installing hana-cli, connecting to SAP HANA databases, inspecting database objects (tables, views, procedures, functions), managing HDI containers, executing SQL queries, converting metadata to CDS/EDMX/OpenAPI formats, managing SAP HANA Cloud instances, working with BTP CLI integration, or troubleshooting hana-cli commands. Covers: 91 commands, 17+ output formats, HDI container management, cloud operations.
npx skill4agent add secondsky/sap-skills sap-hana-cli# Install globally via npm (recommended)
npm install -g hana-cli
# Verify installation
hana-cli version# Interactive connection setup
hana-cli connect
# Or specify connection directly
hana-cli connect -n "hostname:port" -u DBUSER -p PASSWORD --save
# Using service key (HANA Cloud)
hana-cli connectViaServiceKeyexport HANA_HOST="your-hana-host.hanacloud.ondemand.com"
export HANA_PORT="443"
export HANA_USER="DBADMIN"
export HANA_PASSWORD="your-password"
export HANA_ENCRYPT="true" # Optional, defaults to true
export HANA_DATABASE="" # Optional, for MDC tenant
export HANA_CONNECTION_TYPE="single-container" # Optional| Scenario | Recommended Tool | Why |
|---|---|---|
| Exploratory queries, ad-hoc analysis | MCP | Natural language, no syntax needed |
| Automation scripts, CI/CD pipelines | CLI | Scriptable, consistent output |
| Learning database structure | MCP | Conversational discovery |
| Generating CDS/EDMX/OpenAPI output | CLI | Supports 17+ formats |
| Complex multi-step workflows | CLI | Fine-grained control |
| Quick data sampling and inspection | MCP | Faster for one-off queries |
list_schemaslist_tablesdescribe_tablequerysample_datasystem_info# 1. Use MCP to explore (natural language)
"Show me all tables in the PRODUCTS schema"
# 2. Use MCP to understand structure
"Describe the PRODUCTS.INVENTORY table"
# 3. Use CLI for format conversion (precise output)
hana-cli inspectTable -t INVENTORY -s PRODUCTS -o cds
# 4. Use CLI for HDI operations
hana-cli createContainer -c MY_CONTAINER| Command | Aliases | Purpose |
|---|---|---|
| | Inspect table structure |
| - | Inspect view definition |
| - | Inspect stored procedure |
| - | Inspect function definition |
| - | List all tables in schema |
| - | List all views in schema |
| - | List stored procedures |
| - | List functions |
| Command | Aliases | Purpose |
|---|---|---|
| | Execute SQL query |
| | Execute stored procedure |
| - | Direct SQL execution |
| Command | Aliases | Purpose |
|---|---|---|
| | List HDI containers |
| - | Create new container |
| - | Remove container |
| - | Enable HDI service |
| - | Administer HDI privileges |
| Command | Aliases | Purpose |
|---|---|---|
| - | List HANA Cloud instances |
| - | Start cloud instance |
| - | Stop cloud instance |
| - | Configure BTP CLI |
| - | Display BTP target info |
--output-o| Format | Use Case |
|---|---|
| Human-readable table (default) |
| JSON data |
| YAML format |
| CSV export |
| Excel file |
| CAP CDS definitions |
| HANA CDS format |
| HDB Table definitions |
| SQL DDL statements |
| OData EDMX metadata |
| OpenAPI/Swagger spec |
| GraphQL schema |
default-env-admin.json--admin.cdsrc-private.jsoncds bind.env--conndefault-env.json~/.hana-cli/default.jsontemplates/default-env.json# Inspect table structure
hana-cli inspectTable -s MYSCHEMA -t MYTABLE
# Convert to CDS format
hana-cli inspectTable -s MYSCHEMA -t MYTABLE -o cds# Convert all objects in schema to CDS
hana-cli massConvert -s MYSCHEMA# Run query and export to JSON
hana-cli querySimple -q "SELECT * FROM MYTABLE" -o json
# Export to Excel file
hana-cli querySimple -q "SELECT * FROM MYTABLE" -o excel -f ./output -n report# List all containers
hana-cli containers
# Create new container
hana-cli createContainer -c MY_CONTAINER -g MY_GROUP
# Create container users
hana-cli createContainerUsers -c MY_CONTAINERUItablesUIcontainersUImassConvertUIquerySimpleUIsystemInfoUIreferences/command-reference.mdreferences/connection-security.mdreferences/hdi-management.mdreferences/output-formats.mdreferences/cloud-operations.mdreferences/db-inspection.mdreferences/mass-operations.mdreferences/system-admin.mdreferences/web-ui.mdreferences/troubleshooting.mdreferences/development-environment.mdreferences/abap-programming.md# Check current connection status
hana-cli status
# Test with explicit credentials
hana-cli connect -n "host:443" -u USER -p PASS --encrypt true
# Use SSL trust store
hana-cli connect --trustStore /path/to/certificate.pem# Diagnose privilege errors
hana-cli privilegeError
# View current user info
hana-cli inspectUserreferences/command-reference.mdreferences/abap-programming.mdreferences/quick-start.mdscripts/hana-setup.shscripts/migration-helper.sh