Skip to content

dataValidator ​

Command: dataValidator
Category: Data Tools
Status: Production Ready

Description ​

Validate table data against business rules and constraints. You can supply rules inline or via a rules file and optionally limit validation to specific columns.

Syntax ​

bash
hana-cli dataValidator [options]

Aliases ​

  • dval
  • validateData
  • dataValidation

Command Diagram ​

Parameters ​

Positional Arguments ​

None.

Options ​

OptionAliasTypeDefaultDescription
--table-tstring-Name of the table to validate.
--schema-sstring**CURRENT_SCHEMA**Schema name (uses current schema if omitted).
--rules-rstring-Validation rules string in column:rule1,rule2;column2:rule3 format.
--rulesFile--rfstring-Path to a rules file containing the rules string.
--columns-cstring-Comma-separated list of columns to validate.
--output-ostring-Output file path for the report.
--format-fstringjsonReport format. Choices: json, csv, summary, detailed.
--limit-lnumber10000Maximum number of rows to validate.
--stopOnFirstError--sfebooleanfalseStop validation after the first error.
--timeout--tonumber3600Operation timeout in seconds.
--profile-pstring-Connection profile to use.

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 for scripting.
--debug-dbooleanfalseDebug hana-cli with detailed intermediate output.

Special Default Values ​

TokenResolves ToDescription
**CURRENT_SCHEMA**Current user's schemaUsed as default for --schema.

Validation Rules ​

Rules are specified in the format: column:rule1,rule2;column2:rule3.

Supported rules:

  • required - Column must not be null or empty
  • numeric - Column must contain numeric values
  • email - Column must contain valid email addresses
  • date - Column must contain valid dates
  • length:min:max - Column value length must be between min and max
  • pattern:regex - Column must match the specified regex pattern
  • range:min:max - Numeric column must be between min and max

Default Rules Preset ​

If you omit both --rules and --rulesFile, the command generates a default rules preset based on column names:

  • Columns ending with ID or _ID → required
  • Columns containing EMAIL → email
  • Columns ending with DATE, _AT, or _ON → date
  • Columns ending with AMOUNT, PRICE, TOTAL, COUNT, QTY, or QUANTITY → numeric

If no columns match these patterns, the first column is validated as required.

Rules File Format ​

The rules file must contain the same rules string format as --rules (semicolon-separated pairs).

text
email:required,email;firstName:required,length:1:50;lastName:required,length:1:50;age:numeric,range:18:120;zipcode:pattern:^\d{5}(-\d{4})?$

Output Formats ​

  • json: Full JSON results object.
  • csv: CSV error rows (Row,Column,Value,Rule,Error).
  • summary: Text summary report.
  • detailed: JSON printed to console (file output uses the summary report format).

Interactive Mode ​

In interactive mode, you are prompted for:

ParameterRequiredPromptedNotes
tableYesAlwaysTable to validate.
schemaNoAlwaysDefaults to current schema if omitted.
rulesNoSkippedUse --rules or --rulesFile.
columnsNoSkippedUse --columns to limit validation.
outputNoSkippedUse --output to write a file.
formatNoSkippedUse --format to select output.
limitNoSkippedUse --limit to cap rows.
timeoutNoSkippedUse --timeout to cap runtime.
profileNoAlwaysOptional CDS profile.

Examples ​

bash
hana-cli dataValidator --table myTable --rules validation.json

Return Codes ​

  • 0 - Validation completed successfully
  • 1 - Validation error or database connection issue

Performance Tips ​

  1. Use --limit to validate a subset of rows first.
  2. Use --stopOnFirstError to quickly identify issues.
  3. Specify only required columns with --columns to reduce processing.
  4. Use --timeout to prevent long-running validations.

See the Commands Reference for other commands in this category.

See Also ​