Skip to content

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 ​

FormatDescriptionBest For
cdsCAP CDS format with type definitionsCAP/Node.js projects
hdbtableNative HANA HDI table definitionsPure HDI projects
hdbmigrationtableHDI 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 ​

bash
hana-cli massConvert [schema] [table] [view] [options]

Aliases ​

  • mc
  • massconvert
  • massConv
  • massconv

Command Diagram ​

Parameters ​

Positional Arguments ​

ParameterTypeDescription
schemastringSchema name to process (default: current schema)
tablestringDatabase table pattern (supports wildcards, default: *)
viewstringDatabase view pattern (supports wildcards, optional)

Options ​

Source Selection ​

OptionAliasTypeDefaultDescription
--schema-sstring**CURRENT_SCHEMA**Schema name containing tables/views to convert
--table-tstring*Table name pattern (supports SQL wildcards)
--view-vstring-View name pattern (supports SQL wildcards)
--limit-lnumber200Maximum number of objects to convert

Output Configuration ​

OptionAliasTypeDefaultDescription
--output-ostringcdsOutput format. Choices: cds, hdbtable, hdbmigrationtable
--folder-fstring./Output folder for generated files
--filename-nstring-Output file name (single file). If not specified, creates one file per object
--namespace-nsstring""CDS namespace for generated definitions
--synonyms-string""Synonyms output file name (generates synonym definitions)
--log-booleanfalseWrite progress log to file instead of stopping on first error

Type & Format Options ​

OptionAliasTypeDefaultDescription
--useHanaTypes--hanabooleanfalseUse HANA-specific data types (ST_POINT, ST_GEOMETRY, etc.)
--useCatalogPure--catalog, --purebooleanfalseUse pure catalog definitions with associations and merge settings
--useExists--exists, --persistencebooleantrueUse persistence exists annotation in CDS
--useQuoted-q, --quotedbooleanfalseUse quoted identifiers for non-standard names

Path & Naming Options ​

OptionAliasTypeDefaultDescription
--keepPath-booleanfalseKeep table/view path with dots
--noColons-booleanfalseReplace :: in table/view path with .

Connection Parameters ​

OptionAliasTypeDefaultDescription
--admin-abooleanfalseConnect via admin (default-env-admin.json)
--conn-string-Connection filename to override default-env.json

Troubleshooting ​

OptionAliasTypeDefaultDescription
--disableVerbose--quietbooleanfalseDisable verbose output - removes all extra output that is only helpful to human readable interface
--debug-dbooleanfalseDebug hana-cli itself by adding output of LOTS of intermediate details

For a complete list of parameters and options, use:

bash
hana-cli massConvert --help

Examples ​

Convert All Tables to CDS ​

bash
hana-cli massConvert --schema MYSCHEMA --output cds

Convert with Namespace and HDI Format ​

bash
hana-cli massConvert --schema MYSCHEMA --table % --output hdbtable --namespace my.app --folder db/src/

Convert Tables to CDS with Type Preservation ​

bash
hana-cli massConvert --schema MYSCHEMA --table "%" --output cds --useHanaTypes --useCatalogPure

Convert Specific Tables with Limit ​

bash
hana-cli massConvert -s MYSCHEMA -t "CUSTOMER%" -o cds -ns myapp --limit 10

Convert tables in MYSCHEMA to CAP CDS format in the current directory.

Convert Specific Tables to HDI Format ​

bash
hana-cli massConvert --schema MYSCHEMA --table "SALES_%" --output hdbtable

Convert all tables starting with SALES_ to HDI table definitions.

Convert with Namespace ​

bash
hana-cli massConvert --schema MYSCHEMA --namespace "com.company.sales" --output cds

Generate CDS definitions with a proper namespace structure.

Convert to Single File ​

bash
hana-cli massConvert --schema MYSCHEMA --filename schema.cds

Output all table definitions to a single schema.cds file.

Convert with HANA-Specific Types ​

bash
hana-cli massConvert --schema GIS_DATA --useHanaTypes --output cds

Convert spatial/geometric tables preserving HANA-specific types like ST_POINT.

Migration Table Format (Preserve Data) ​

bash
hana-cli massConvert --schema LEGACY --output hdbmigrationtable --folder ./migration

Generate HDI migration tables that preserve existing data during deployment.

Convert with Quoted Identifiers ​

bash
hana-cli massConvert --schema MYSCHEMA --table "Special-Name%" --useQuoted

Convert tables with special characters in names using quoted identifiers.

Generate with Synonyms ​

bash
hana-cli massConvert --schema MYSCHEMA --synonyms synonyms.hdbsynonym

Convert tables and generate corresponding synonym definitions.

Large Schema with Logging ​

bash
hana-cli massConvert --schema BIGSCHEMA --limit 500 --log --folder ./converted

Convert up to 500 objects, continuing on errors and logging progress to file.

Pure Catalog Mode ​

bash
hana-cli massConvert --schema MYSCHEMA --useCatalogPure --output cds

Generate pure catalog definitions including associations and merge settings.

Advanced Usage ​

Pattern Matching ​

Use SQL wildcards for selective conversion:

bash
# 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 ​

bash
# Keep original dotted paths
hana-cli massConvert --keepPath

# Replace :: with . in paths
hana-cli massConvert --noColons

# Use quoted identifiers for compatibility
hana-cli massConvert --useQuoted

Custom Output Organization ​

bash
# 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.entities

Output Examples ​

CDS Output Format ​

cds
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 ​

sql
COLUMN TABLE "CUSTOMERS" (
  "CUSTOMER_ID" INTEGER NOT NULL,
  "NAME" NVARCHAR(100),
  "EMAIL" NVARCHAR(255),
  "CREATED_AT" TIMESTAMP,
  PRIMARY KEY ("CUSTOMER_ID")
)

Progress Output ​

text
Converting Tables to cds:
  ✓ CUSTOMERS
  ✓ ORDERS
  ✓ PRODUCTS
  ✓ INVOICES

Successfully converted 4 tables to ./db/src/

Best Practices ​

1. Start with a Test Schema ​

bash
# Test conversion on a small subset first
hana-cli massConvert --schema TEST_SCHEMA --limit 10

2. Use Namespaces for CDS ​

bash
# 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 ​

bash
# Use limits and logging for large conversions
hana-cli massConvert --limit 200 --log --folder ./batch1

5. 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 TypeStandard CDS (useHanaTypes=false)HANA-Specific (useHanaTypes=true)
ST_POINTBinaryhana.ST_POINT
ST_GEOMETRYBinaryhana.ST_GEOMETRY
NVARCHARStringString
DECIMALDecimalDecimal
TIMESTAMPTimestampTimestamp

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

bash
# Solution: Use limit or pattern matching
hana-cli massConvert --limit 100
hana-cli massConvert --table "ACTIVE_%"

Issue: Special characters in table names

bash
# Solution: Use quoted identifiers
hana-cli massConvert --useQuoted

Issue: Conversion errors stopping process

bash
# Solution: Enable logging to continue
hana-cli massConvert --log

Issue: Need to preserve associations

bash
# Solution: Use pure catalog mode
hana-cli massConvert --useCatalogPure

massConvertUI (UI Variant) ​

Command: massConvertUI
Status: Production Ready

Description: Convert a group of tables to CDS or HDBTable format via browser-based UI

Syntax:

bash
hana-cli massConvertUI [schema] [table] [options]

Aliases:

  • mcui
  • massconvertui
  • massConvUI
  • massconvui

Parameters:

All massConvert options apply, plus:

OptionAliasTypeDefaultDescription
--port-pinteger3010Port to run the HTTP server for the UI

Example Usage:

bash
# 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 MYSCHEMA

The 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

See the Commands Reference for other commands in this category.

See Also ​