massConvert ​
Command:
massConvert
Category: Mass Operations
Status: Production Ready
Description ​
Convert a group of tables and views to CDS or HDBTable format. This command generates CAP CDS definitions or native HANA HDI artifacts from existing database tables and views, enabling migration from classic database schemas to modern HDI-based development.
Use Cases ​
- Schema Migration: Convert existing tables to HDI artifacts for cloud-native deployment
- CAP Development: Generate CDS models from legacy database structures
- Documentation: Create declarative definitions of existing schemas
- Multi-Target: Export to both CDS and HDI formats for different deployment targets
- Bulk Conversion: Process entire schemas or filtered object sets at once
Output Formats ​
| Format | Description | Best For |
|---|---|---|
cds | CAP CDS format with type definitions | CAP/Node.js projects |
hdbtable | Native HANA HDI table definitions | Pure HDI projects |
hdbmigrationtable | HDI migration table format (preserves data) | Migrating existing data |
Key Features ​
- Wildcard Support: Use patterns to select multiple tables/views
- Type Mapping: Automatic conversion between database and CDS types
- Namespace Support: Generate CDS with proper namespace structure
- Path Handling: Flexible options for handling dotted paths and colons
- Synonym Generation: Optional creation of synonym definitions
- Progress Logging: Continuous logging for large conversion operations
Syntax ​
hana-cli massConvert [schema] [table] [view] [options]Aliases ​
mcmassconvertmassConvmassconv
Command Diagram ​
Parameters ​
Positional Arguments ​
| Parameter | Type | Description |
|---|---|---|
schema | string | Schema name to process (default: current schema) |
table | string | Database table pattern (supports wildcards, default: *) |
view | string | Database view pattern (supports wildcards, optional) |
Options ​
Source Selection ​
| Option | Alias | Type | Default | Description |
|---|---|---|---|---|
--schema | -s | string | **CURRENT_SCHEMA** | Schema name containing tables/views to convert |
--table | -t | string | * | Table name pattern (supports SQL wildcards) |
--view | -v | string | - | View name pattern (supports SQL wildcards) |
--limit | -l | number | 200 | Maximum number of objects to convert |
Output Configuration ​
| Option | Alias | Type | Default | Description |
|---|---|---|---|---|
--output | -o | string | cds | Output format. Choices: cds, hdbtable, hdbmigrationtable |
--folder | -f | string | ./ | Output folder for generated files |
--filename | -n | string | - | Output file name (single file). If not specified, creates one file per object |
--namespace | -ns | string | "" | CDS namespace for generated definitions |
--synonyms | - | string | "" | Synonyms output file name (generates synonym definitions) |
--log | - | boolean | false | Write progress log to file instead of stopping on first error |
Type & Format Options ​
| Option | Alias | Type | Default | Description |
|---|---|---|---|---|
--useHanaTypes | --hana | boolean | false | Use HANA-specific data types (ST_POINT, ST_GEOMETRY, etc.) |
--useCatalogPure | --catalog, --pure | boolean | false | Use pure catalog definitions with associations and merge settings |
--useExists | --exists, --persistence | boolean | true | Use persistence exists annotation in CDS |
--useQuoted | -q, --quoted | boolean | false | Use quoted identifiers for non-standard names |
Path & Naming Options ​
| Option | Alias | Type | Default | Description |
|---|---|---|---|---|
--keepPath | - | boolean | false | Keep table/view path with dots |
--noColons | - | boolean | false | Replace :: in table/view path with . |
Connection Parameters ​
| Option | Alias | Type | Default | Description |
|---|---|---|---|---|
--admin | -a | boolean | false | Connect via admin (default-env-admin.json) |
--conn | - | string | - | Connection filename to override default-env.json |
Troubleshooting ​
| Option | Alias | Type | Default | Description |
|---|---|---|---|---|
--disableVerbose | --quiet | boolean | false | Disable verbose output - removes all extra output that is only helpful to human readable interface |
--debug | -d | boolean | false | Debug hana-cli itself by adding output of LOTS of intermediate details |
For a complete list of parameters and options, use:
hana-cli massConvert --helpExamples ​
Convert All Tables to CDS ​
hana-cli massConvert --schema MYSCHEMA --output cdsConvert with Namespace and HDI Format ​
hana-cli massConvert --schema MYSCHEMA --table % --output hdbtable --namespace my.app --folder db/src/Convert Tables to CDS with Type Preservation ​
hana-cli massConvert --schema MYSCHEMA --table "%" --output cds --useHanaTypes --useCatalogPureConvert Specific Tables with Limit ​
hana-cli massConvert -s MYSCHEMA -t "CUSTOMER%" -o cds -ns myapp --limit 10Convert tables in MYSCHEMA to CAP CDS format in the current directory.
Convert Specific Tables to HDI Format ​
hana-cli massConvert --schema MYSCHEMA --table "SALES_%" --output hdbtableConvert all tables starting with SALES_ to HDI table definitions.
Convert with Namespace ​
hana-cli massConvert --schema MYSCHEMA --namespace "com.company.sales" --output cdsGenerate CDS definitions with a proper namespace structure.
Convert to Single File ​
hana-cli massConvert --schema MYSCHEMA --filename schema.cdsOutput all table definitions to a single schema.cds file.
Convert with HANA-Specific Types ​
hana-cli massConvert --schema GIS_DATA --useHanaTypes --output cdsConvert spatial/geometric tables preserving HANA-specific types like ST_POINT.
Migration Table Format (Preserve Data) ​
hana-cli massConvert --schema LEGACY --output hdbmigrationtable --folder ./migrationGenerate HDI migration tables that preserve existing data during deployment.
Convert with Quoted Identifiers ​
hana-cli massConvert --schema MYSCHEMA --table "Special-Name%" --useQuotedConvert tables with special characters in names using quoted identifiers.
Generate with Synonyms ​
hana-cli massConvert --schema MYSCHEMA --synonyms synonyms.hdbsynonymConvert tables and generate corresponding synonym definitions.
Large Schema with Logging ​
hana-cli massConvert --schema BIGSCHEMA --limit 500 --log --folder ./convertedConvert up to 500 objects, continuing on errors and logging progress to file.
Pure Catalog Mode ​
hana-cli massConvert --schema MYSCHEMA --useCatalogPure --output cdsGenerate pure catalog definitions including associations and merge settings.
Advanced Usage ​
Pattern Matching ​
Use SQL wildcards for selective conversion:
# Convert all tables starting with TEMP_
hana-cli massConvert --table "TEMP_%"
# Convert both tables and views matching pattern
hana-cli massConvert --table "DATA_%" --view "V_DATA_%"
# Convert tables ending with _LOG
hana-cli massConvert --table "%_LOG"Handling Special Paths ​
# Keep original dotted paths
hana-cli massConvert --keepPath
# Replace :: with . in paths
hana-cli massConvert --noColons
# Use quoted identifiers for compatibility
hana-cli massConvert --useQuotedCustom Output Organization ​
# Output to specific folder structure
hana-cli massConvert --folder ./db/src/tables --output hdbtable
# Single file with namespace
hana-cli massConvert --filename all-entities.cds --namespace app.entitiesOutput Examples ​
CDS Output Format ​
namespace com.example.sales;
entity CUSTOMERS {
key CUSTOMER_ID : Integer;
NAME : String(100);
EMAIL : String(255);
CREATED_AT : Timestamp;
}
entity ORDERS {
key ORDER_ID : Integer;
CUSTOMER_ID : Integer;
ORDER_DATE : Date;
TOTAL_AMOUNT : Decimal(15,2);
}HDI Table Output Format ​
COLUMN TABLE "CUSTOMERS" (
"CUSTOMER_ID" INTEGER NOT NULL,
"NAME" NVARCHAR(100),
"EMAIL" NVARCHAR(255),
"CREATED_AT" TIMESTAMP,
PRIMARY KEY ("CUSTOMER_ID")
)Progress Output ​
Converting Tables to cds:
✓ CUSTOMERS
✓ ORDERS
✓ PRODUCTS
✓ INVOICES
Successfully converted 4 tables to ./db/src/Best Practices ​
1. Start with a Test Schema ​
# Test conversion on a small subset first
hana-cli massConvert --schema TEST_SCHEMA --limit 102. Use Namespaces for CDS ​
# Always use namespaces for organized CDS models
hana-cli massConvert --namespace "app.db.tables"3. Choose the Right Output Format ​
- CDS: For CAP applications and cross-database portability
- HDI Table: For pure HANA HDI deployments
- HDI Migration: When preserving existing data is critical
4. Handle Large Schemas Carefully ​
# Use limits and logging for large conversions
hana-cli massConvert --limit 200 --log --folder ./batch15. Review Generated Files ​
Always review generated definitions before deployment:
- Check type mappings are appropriate
- Verify constraints and keys are preserved
- Test in development before production
Type Mapping ​
Standard vs HANA-Specific Types ​
| Database Type | Standard CDS (useHanaTypes=false) | HANA-Specific (useHanaTypes=true) |
|---|---|---|
| ST_POINT | Binary | hana.ST_POINT |
| ST_GEOMETRY | Binary | hana.ST_GEOMETRY |
| NVARCHAR | String | String |
| DECIMAL | Decimal | Decimal |
| TIMESTAMP | Timestamp | Timestamp |
Use --useHanaTypes when:
- Working with spatial/geometric data
- Using HANA-specific features
- Not planning cross-database deployment
Common Issues & Solutions ​
Issue: Too many objects to convert
# Solution: Use limit or pattern matching
hana-cli massConvert --limit 100
hana-cli massConvert --table "ACTIVE_%"Issue: Special characters in table names
# Solution: Use quoted identifiers
hana-cli massConvert --useQuotedIssue: Conversion errors stopping process
# Solution: Enable logging to continue
hana-cli massConvert --logIssue: Need to preserve associations
# Solution: Use pure catalog mode
hana-cli massConvert --useCatalogPuremassConvertUI (UI Variant) ​
Command:
massConvertUI
Status: Production Ready
Description: Convert a group of tables to CDS or HDBTable format via browser-based UI
Syntax:
hana-cli massConvertUI [schema] [table] [options]Aliases:
mcuimassconvertuimassConvUImassconvui
Parameters:
All massConvert options apply, plus:
| Option | Alias | Type | Default | Description |
|---|---|---|---|---|
--port | -p | integer | 3010 | Port to run the HTTP server for the UI |
Example Usage:
# Launch UI on default port
hana-cli massConvertUI
# Launch UI on custom port
hana-cli massConvertUI --port 8080
# Pre-select schema in UI
hana-cli massConvertUI --schema MYSCHEMAThe browser-based UI provides:
- Interactive schema and object selection
- Real-time preview of conversion options
- Visual feedback during conversion process
- Download converted files directly from browser
Related Commands ​
- massDelete - Bulk delete database objects
- massExport - Export database objects in various formats
- massRename - Rename fields in CDS-based export files
- massUpdate - Bulk update database records
- cds - Display database objects via CDS
- createModule - Create new DB module structure
See the Commands Reference for other commands in this category.