FAQ - Frequently Asked Questions
Answers for common questions from users and contributors.
Installation & Setup
Q: Do I need SAP HANA installed locally?
A: No. You only need network access to a SAP HANA database instance. This can be:
- Remote SAP HANA server
- SAP HANA Express Edition (local or remote)
- SAP BTP HANA service
- SAP HANA Cloud
Q: What's the minimum Node.js version required?
A: Node.js 20.19.0 or higher.
node --versionQ: Can I use HANA CLI in the cloud?
A: Yes! HANA CLI works great in cloud environments:
- SAP Business Application Studio
- Google Cloud Shell
- AWS Cloud9
- GitHub Codespaces
- Azure Cloud Shell
Q: How do I specify my database connection?
A: Three methods (in order of preference):
- default-env.json (recommended for local development)
- Environment variables (recommended for cloud/CI-CD)
- Command-line arguments (for one-off commands)
Command Usage
Q: What's the difference between export and querySimple?
A: They are two different commands:
export: Exports table data to a file (CSV, Excel, or JSON). Use WHERE clauses to filter rows.
hana-cli export -s SCHEMA -t TABLE -o output.csvquerySimple: Executes SQL queries and displays results in various formats.
hana-cli querySimple --query "SELECT * FROM SCHEMA.TABLE" --output csvQ: How do I import data from JSON?
A: Currently CSV and Excel formats are supported. To import JSON:
# Convert JSON to CSV first
# Or request enhancement: https://github.com/SAP-samples/hana-developer-cli-tool-example/issuesQ: Can I import without creating the table first?
A: No, the table must exist. You can create it using SAP HANA Web IDE or SQL:
CREATE TABLE HR.EMPLOYEES (
ID INT,
NAME VARCHAR(255),
SALARY DECIMAL(10,2)
);Q: How do I handle large CSV files?
A: HANA CLI processes files line-by-line, so size isn't an issue. For optimal performance:
# Monitor import
hana-cli import -n large-file.csv -t TABLE --verbose
# Or batch into smaller files and import separatelyQ: Can I update existing records during import?
A: No, import inserts only. For updates, use dataSync:
hana-cli dataSync -s1 STAGING -t1 DATA -s2 PROD -t2 DATA --mode upsertData Operations
Q: How do I compare schemas between two systems?
A: Use the compareSchema command:
hana-cli compareSchema -s1 DEV_SCHEMA -s2 PROD_SCHEMAQ: Can I clone a table with data to another schema?
A: Yes, use tableCopy with --data flag:
hana-cli tableCopy -s1 PROD -t1 CUSTOMERS -s2 DEV -t2 CUSTOMERS --dataQ: How do I find duplicate records?
A: Use duplicateDetection:
hana-cli duplicateDetection -s SCHEMA -t TABLE -c "FIRST_NAME,LAST_NAME"Q: What's the difference between dataProfile and dataValidator?
A:
- dataProfile: Shows statistics (counts, nulls, distinct values)
- dataValidator: Checks data quality (constraints, types, rules)
Q: How do I export only rows that match a condition?
A: Use the WHERE clause:
hana-cli export -s SCHEMA -t TABLE -w "STATUS='ACTIVE'" -o active.csvQ: Can I import different file formats?
A: Currently supported:
- CSV (comma-separated values)
- Excel (.xlsx files)
Use -o excel for Excel files when importing from Excel format.
Q: What if my data types don't match?
A: The import command has improved data type handling:
- Auto-detects common types
- Reports mismatches with clear errors
- Suggests corrections
- Use
--debugflag for detailed type information
Performance & Troubleshooting
Q: Why did startup time improve so much?
A: The 60-77% improvement comes from:
- Lazy-loading command modules (only load what's needed)
- Ultra-fast path for
--versionflag - Deferred yargs loading
- Conditional debug module loading
- Eliminated completion overhead
Startup went from ~2,200ms to ~700ms for most commands.
Q: Why are my queries slow?
A: Common causes:
- Large table - use
--limitto test first - Network latency - check connection quality
- Database load - check with DBA
- Missing indexes - HANA optimizer issue
Solutions:
# Test with limit
hana-cli export -s SCHEMA -t TABLE --limit 100
# Enable debug to see execution time
hana-cli export -s SCHEMA -t TABLE --debugQ: How do I fix "connection refused" error?
A: Check:
- Host and port are correct
- HANA service is running
- Network/firewall allows connection
- Credentials are valid
# Verify configuration
cat default-env.json | jq .
# Test connection explicitly
echo "" | nc -zv your-hana-host 30013Q: Can I use HANA CLI with proxy?
A: Yes, via environment variables:
export http_proxy=http://proxy.company.com:8080
export https_proxy=https://proxy.company.com:8080
export no_proxy=localhost,internalhosts
hana-cli dbInfoQ: How do I enable verbose logging?
A: Use --debug flag to enable detailed logging:
# Debug mode shows execution details
hana-cli import -n data.csv -t TABLE --debug
hana-cli dataProfile -s SCHEMA -t TABLE --debug
# Or set logging level via environment variable
export HANA_LOG_LEVEL=debug
hana-cli dbInfoAPI & Integration
Q: How do I use HANA CLI as a REST API server?
A: Start the server:
hana-cli server --port 3000Then access via HTTP:
curl http://localhost:3000/api/v1/dbInfoSwagger UI available at: http://localhost:3000/api-docs
See API Server Guide
Q: Can I integrate with my CI/CD pipeline?
A: Yes! Works with GitHub Actions, GitLab CI, Jenkins, etc.
# Install in CI environment
npm install -g hana-cli
# Use in your pipeline
hana-cli export -s SCHEMA -t TABLE -o backup.csvMCP & AI
Q: What is the MCP Server for?
A: Model Context Protocol enables AI assistants to interact with HANA CLI. It allows:
- AI-assisted database queries
- Automated schema analysis
- Code generation for data operations
- Integration with Claude, ChatGPT, etc.
Q: How do I use HANA CLI with AI coding assistants?
A: Set up MCP (Model Context Protocol):
cd mcp-server
npm install
npm run buildQ: Where is MCP Server documentation?
A: See Development Guide - MCP Server
Languages & Localization
Q: In what languages is HANA CLI available?
A: English, German, Spanish, French, Japanese, Korean, Portuguese, Simplified Chinese, Hindi, and Polish are fully supported.
Q: How do I use localization?
Examples:
# German
export LANG=de
hana-cli dbInfo
# Simplified Chinese
export LANG=zh_CN.UTF-8
hana-cli dbInfo
# Hindi
export LANG=hi_IN.UTF-8
hana-cli dbInfo
# Polish
export LANG=pl_PL.UTF-8
hana-cli dbInfo
# Japanese
export LANG=ja
hana-cli dbInfo
# Korean
export LANG=ko
hana-cli dbInfoAlternatively, use standard locale variables: LC_ALL, LC_MESSAGES, or LANGUAGE.
Q: How do I contribute translations?
A: See Internationalization guide.
Development & Architecture
Q: How is the project structure organized?
A: The project is organized as:
├── bin/ # CLI entry points
├── app/ # Command implementations
├── utils/ # Utility functions
├── routes/ # API routes (REST server)
├── tests/ # Test files
├── types/ # TypeScript type definitions
├── docs/ # This documentation (VitePress)
├── mcp-server/ # Model Context Protocol implementation
└── _i18n/ # Internationalization filesQ: Where do I add a new command?
A:
- Create implementation in
app/[command-name].js - Add builder and handler functions
- Export from
app/index.js - Add tests in
tests/ - Document in
docs/02-commands/
Q: How is testing organized?
A: Test coverage has expanded from ~40% to ~85% with:
- 317+ new test cases
- 6 dedicated test files
- Focus on critical paths
- Run with:
npm test
Upgrades & Compatibility
Q: How do I upgrade HANA CLI?
npm install -g hana-cli@latestOr from source:
git clone https://github.com/SAP-samples/hana-developer-cli-tool-example
cd hana-developer-cli-tool-example
npm install
npm linkQ: Is version 4.x backward compatible?
A: Mostly yes. Main breaking change:
- Express upgraded from 4.x to 5.x
- May affect REST API integration
See Changelog for details.
Custom Builds
Q: Can I customize HANA CLI?
A: Yes, you can:
- Fork the repository
- Modify source code in
app/,utils/,routes/ - Run tests:
npm test - Build:
npm run build - Install locally:
npm link
Licensing & Community
Q: Is HANA CLI free?
A: Yes! It's open-source under Apache License 2.0.
Q: Can I modify and redistribute?
A: Yes, following Apache License 2.0 terms. See LICENSE
Q: Where can I report bugs?
Q: How can I contribute?
A: Via pull requests! See CONTRIBUTING.md in the repository.
Getting More Help
- Documentation: Full Docs
- Troubleshooting: Troubleshooting Guide
- Development Guide: Development Guide
- GitHub: Repository
- Issues: Report Problems
- Knowledge Base: Run
hana-cli kb search "topic"