A developer-centric command-line interface for SAP HANA database development, particularly useful in non-SAP tooling environments like VS Code.
Repository: https://github.com/SAP-samples/hana-developer-cli-tool-example npm Package: https://www.npmjs.com/package/hana-cli Current Version: 3.202405.1 (April 2024) Node.js Requirement: ≥20.19.0
Table of Contents
Quick Start
Installation
# Install globally via npm (recommended)
npm install -g hana-cli
# Verify installation
hana-cli version
First Connection
# 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 connectViaServiceKey
Core Command Categories
Database Object Inspection
| inspectTable
| it, table
| Inspect table structure
inspectView |
|---|
| Inspect view definition |
inspectProcedure |
|---|
| Inspect stored procedure |
inspectFunction |
|---|
| Inspect function definition |
tables |
|---|
| List all tables in schema |
views |
|---|
| List all views in schema |
procedures |
|---|
| List stored procedures |
functions |
|---|
| List functions |
Query Execution
| querySimple
| qs
| Execute SQL query
| callProcedure
| cp
| Execute stored procedure
hdbsql |
|---|
| Direct SQL execution |
HDI Container Management
| containers
| cont
| List HDI containers
createContainer |
|---|
| Create new container |
dropContainer |
|---|
| Remove container |
activateHDI |
|---|
| Enable HDI service |
adminHDI |
|---|
| Administer HDI privileges |
Cloud & BTP Operations
hanaCloudInstances |
|---|
| List HANA Cloud instances |
hanaCloudStart |
|---|
| Start cloud instance |
hanaCloudStop |
|---|
| Stop cloud instance |
btp |
|---|
| Configure BTP CLI |
btpInfo |
|---|
| Display BTP target info |
Output Formats
The --output / -o option supports 17+ formats:
| tbl
| Human-readable table (default)
| json
| JSON data
| yaml
| YAML format
| csv
| CSV export
| excel
| Excel file
| cds
| CAP CDS definitions
| hdbcds
| HANA CDS format
| hdbtable
| HDB Table definitions
| sql
| SQL DDL statements
| edmx
| OData EDMX metadata
| openapi
| OpenAPI/Swagger spec
| graphql
| GraphQL schema
Connection Configuration
Connection credentials are searched in priority order:
-
default-env-admin.json(with--adminflag) -
.cdsrc-private.json(viacds bind) -
.envfile with VCAP_SERVICES -
File specified via
--connparameter -
default-env.jsonin current/parent directories -
~/.hana-cli/default.json
For connection templates, see templates/default-env.json.
Common Workflows
Inspect and Convert Table to CDS
# Inspect table structure
hana-cli inspectTable -s MYSCHEMA -t MYTABLE
# Convert to CDS format
hana-cli inspectTable -s MYSCHEMA -t MYTABLE -o cds
Mass Convert Schema Objects
# Convert all objects in schema to CDS
hana-cli massConvert -s MYSCHEMA
Execute Query with Export
# 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
Manage HDI Containers
# 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_CONTAINER
UI Commands
Many commands have browser-based UI alternatives (suffix UI):
-
tablesUI- Browse tables visually -
containersUI- Manage containers in browser -
massConvertUI- Visual mass conversion -
querySimpleUI- Query builder interface -
systemInfoUI- System dashboard
Key Features
-
Multi-database support: HANA, PostgreSQL, SQLite backends
-
Format conversion: 17+ output formats including CDS, EDMX, OpenAPI
-
HDI management: Full container lifecycle management
-
Cloud integration: SAP BTP CLI and HANA Cloud support
-
Interactive prompts: Missing parameters prompted automatically
-
Service key auth: Secure cloud authentication
Detailed References
For comprehensive documentation:
-
All 91 Commands: See
references/command-reference.md -
Connection & Security: See
references/connection-security.md -
HDI Management: See
references/hdi-management.md -
Output Formats: See
references/output-formats.md -
Cloud Operations: See
references/cloud-operations.md -
Database Inspection: See
references/db-inspection.md -
Mass Operations: See
references/mass-operations.md -
System Administration: See
references/system-admin.md -
Web UI Interface: See
references/web-ui.md -
Troubleshooting Guide: See
references/troubleshooting.md -
Development Environment: See
references/development-environment.md -
ABAP Programming Patterns: See
references/abap-programming.md
Troubleshooting
Connection Issues
# 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
Permission Errors
# Diagnose privilege errors
hana-cli privilegeError
# View current user info
hana-cli inspectUser
Version Compatibility
-
Node.js: Requires ≥20.19.0
-
@sap/cds: Uses 9.4.4
-
@sap/cds-dk: Requires ≥8.9 for cds bind
Bundled Resources
Reference Documentation
-
references/command-reference.md- Complete command reference with all options -
references/abap-programming.md- ABAP-specific programming patterns -
references/quick-start.md- Quick start guide and examples
Scripts
-
scripts/hana-setup.sh- HANA development environment setup script -
scripts/migration-helper.sh- Migration helper script for existing projects
Resources
-
GitHub: https://github.com/SAP-samples/hana-developer-cli-tool-example
-
Intro Video: https://youtu.be/dvVQfi9Qgog
-
Cloud Shells Demo: https://youtu.be/L7QyVLvAIIQ
-
SAP HANA Cloud: https://help.sap.com/docs/hana-cloud
-
SAP CAP: https://cap.cloud.sap/docs/
Last Updated: 2025-11-26 | Version: 1.1.0