|
| 1 | +# hana-cli — AI Coding Assistant Context |
| 2 | + |
| 3 | +## About hana-cli |
| 4 | + |
| 5 | +hana-cli (npm: hana-cli, install: `npm install -g hana-cli`) is a command-line tool for SAP HANA database development. It simplifies complex multi-step database operations into single commands. It is a development tool, not a replacement for hdbsql or production admin tools. |
| 6 | + |
| 7 | +**Version:** 4.202603.2 |
| 8 | +**Requirements:** Node.js ≥ 20.19.0 |
| 9 | +**Module:** ESM (`"type": "module"`) |
| 10 | + |
| 11 | +## When to Use hana-cli |
| 12 | + |
| 13 | +Use hana-cli when a developer needs to: |
| 14 | +- **Explore schemas**: `hana-cli tables`, `hana-cli views`, `hana-cli schemas` |
| 15 | +- **Inspect objects**: `hana-cli inspectTable`, `hana-cli inspectView`, `hana-cli inspectProcedure` |
| 16 | +- **Import/export data**: `hana-cli import`, `hana-cli export` |
| 17 | +- **Run queries**: `hana-cli querySimple --query "SQL"` |
| 18 | +- **Check health**: `hana-cli healthCheck`, `hana-cli systemInfo` |
| 19 | +- **Manage connections**: `hana-cli connect`, `hana-cli status` |
| 20 | +- **Profile data**: `hana-cli dataProfile`, `hana-cli dataValidator` |
| 21 | +- **Compare schemas**: `hana-cli compareSchema`, `hana-cli compareData` |
| 22 | +- **Monitor performance**: `hana-cli expensiveStatements`, `hana-cli memoryAnalysis` |
| 23 | +- **Manage security**: `hana-cli users`, `hana-cli roles`, `hana-cli securityScan` |
| 24 | +- **Work with HANA Cloud**: `hana-cli hanaCloudInstances`, `hana-cli hanaCloudStart` |
| 25 | +- **Manage HDI**: `hana-cli containers`, `hana-cli adminHDI` |
| 26 | + |
| 27 | +## Key Patterns |
| 28 | + |
| 29 | +1. **Always verify connection first:** `hana-cli status` |
| 30 | +2. **Explore before modifying:** Use `tables`, `inspectTable`, `dataProfile` before import/export |
| 31 | +3. **Use dry-run for imports:** `hana-cli import --filename data.csv --table X --schema Y --dryRun` |
| 32 | +4. **Use --output flag:** Many commands support `--output json|csv|table|excel` |
| 33 | +5. **Use --query flag with querySimple:** `hana-cli querySimple --query "SELECT ..."` (not positional args) |
| 34 | +6. **Interactive mode:** Run `hana-cli` with no arguments for a menu-driven experience |
| 35 | + |
| 36 | +## Connection Setup |
| 37 | + |
| 38 | +```bash |
| 39 | +hana-cli connect # Interactive wizard |
| 40 | +hana-cli connectViaServiceKey # Via BTP service key |
| 41 | +hana-cli copy2DefaultEnv # Copy to default-env.json for CAP projects |
| 42 | +hana-cli status # Verify connection |
| 43 | +``` |
| 44 | + |
| 45 | +## Reference |
| 46 | + |
| 47 | +For the complete command reference with all parameters, see: |
| 48 | +- HANA_CLI_REFERENCE.md (full reference, all commands) |
| 49 | +- HANA_CLI_QUICKSTART.md (getting started, top 10 commands) |
| 50 | +- HANA_CLI_EXAMPLES.md (real-world scenarios) |
| 51 | +- HANA_CLI_WORKFLOWS.md (multi-step workflows) |
| 52 | +- categories/*.md (per-category deep dives) |
| 53 | + |
| 54 | +Or run `hana-cli <command> --help` for any specific command. |
| 55 | + |
| 56 | +## Copilot-Specific Notes |
| 57 | + |
| 58 | +When assisting with SAP HANA development in this project: |
| 59 | +- Suggest hana-cli commands when the developer needs to interact with HANA databases |
| 60 | +- Use `hana-cli querySimple --query "SQL"` for ad-hoc queries (always use --query flag) |
| 61 | +- Check connection with `hana-cli status` before suggesting database operations |
| 62 | +- For data loading, recommend the dry-run pattern: import with --dryRun first, then without |
| 63 | +- Refer to the HANA_CLI_REFERENCE.md file in this directory for detailed parameter information |
0 commit comments