Docs/Commands/validate-sql
Progenerated from cli/_parser_setup.py
dblift validate-sql
Validate SQL files against business rules and performance analysis. It does not verify SQL syntax and does not run SQLFluff. Findings land next to the migration line that produced them, and can be written as SARIF or GitLab format for your code review tooling. For the rules themselves, see SQL validation.
Synopsis
$ dblift validate-sql [FILES ...]
[--dialect DIALECT] [--format FORMAT] [--output PATH]
[--fail-on LEVEL] [--severity-threshold LEVEL]
[--rules-file PATH] [--profile NAME] [--rules RULES]
[--no-performance]Options
FlagDescription
filesSQL files or directories to validate (defaults to migration scripts directory)--dialectSQL dialect (defaults to dialect from database config)--basePublished schema snapshot to validate against (file path), overriding the configured snapshot.source. Named here, a missing or tampered file is an error; taken from the configuration, an unreadable one just means no base.--formatOutput format (default: console)--outputOptional file path for console, JSON, SARIF, GitLab, compact, or HTML output--fail-onMinimum finding severity that makes the command fail (default: from config or error)--severity-thresholdMinimum severity to report (default: from config or 'warning')--rules-filePath to custom validation rules YAML file--profileBuilt-in validation profile to apply (core, enterprise, strict, technical-debt)--rulesRule packs or individual rules to apply; accepts comma-separated or repeated values--no-performanceDisable performance analysis (only run business rules)Global flags apply to every command: --config, --env, --scripts, --dry-run, --quiet, --log-level. See global flags.
Examples
Pro: custom rules file
$ dblift validate-sql --rules-file .dblift_rules.yamlEmit SARIF for code scanning, failing the job on errors
$ dblift validate-sql --format sarif --output results.sarif --fail-on errorEnterprise: named profile
$ dblift validate-sql migrations/V2_4_0__add_index.sql --profile strictExit codes
CodeMeaning
0Command completed successfully4A paid-edition feature was invoked without a valid licence (EXIT_LICENSE_REQUIRED)