Docs/Commands/validate-sql
OSSProEnterprisegenerated from cli/_parser_setup.py

dblift validate-sql

Validate SQL files offline. On pip install "dblift[cli]" the command runs 17 migration-safety rules and prints console or JSON with no licence. The commercial build runs that same baseline with no licence. An unread statement is REVIEW at INFO severity and does not fail on its own. The command needs dblift[analysis]. There is no performance analyser on the baseline. Pro adds a custom rules file, --rules security, --rules schema, the performance analyser, --output, --fail-on, --base, --severity-threshold, --no-performance, and HTML, SARIF, GitHub Actions, GitLab, and compact output. Enterprise adds named profiles, the best_practices, performance and naming packs, and individual rule IDs. It does not verify SQL syntax and does not run SQLFluff. For the rules themselves, see SQL validation.

Synopsis

$ dblift validate-sql [--files FILE ...] [--dialect DIALECT] [--format {console,json}] [--placeholders KEY=VALUE ...]

Options

FlagDescription
--db-urlDatabase URL
--db-usernameDatabase username
--db-passwordDatabase password
--db-schemaDatabase schema
--filesCheck these files instead of the V and R scripts of the migration directories
--dialectSQL dialect to read the files in (default: the configured database type)
--formatOutput format (default: console)
--placeholdersSQL placeholders for variable substitution in migration scripts. Format: key1=value1,key2=value2 or key1=value1 key2=value2. Can be repeated: --placeholders k1=v1 --placeholders k2=v2

Open source vs Pro and Enterprise

The open-source package runs validate-sql with no licence. pip install "dblift[cli]" includes analysis. The open-source set is 17 migration-safety rules. The commercial build runs that same baseline with no licence. A paid flag needs Pro.

EditionWhat it adds
OSS17 migration-safety rules, a SAFE/REVIEW/UNSAFE verdict, and exit 1 on UNSAFE. REVIEW does not exit 1 on its own. --files, --dialect, --format console or json, and --placeholders. No performance analyser. The open-source MCP server has no validate_sql tool. The commercial build runs this same baseline with no licence.
Pro--rules-file, --rules security, --rules schema, --output, --fail-on, --base, --severity-threshold, and --no-performance. Formats sarif, github-actions, gitlab, compact, and html. The performance analyser, and the MCP validate_sql tool.
EnterpriseNamed profiles (core, enterprise, strict, technical-debt). The best_practices, performance, and naming packs, and individual rule IDs.

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.yaml

Pro: emit SARIF for code scanning, failing the job on errors

$ dblift validate-sql --format sarif --output results.sarif --fail-on error

Enterprise: named profile

$ dblift validate-sql migrations/V2_4_0__add_index.sql --profile strict

Exit codes

CodeMeaning
0Command completed successfully
1A script is UNSAFE. REVIEW does not exit 1 on its own.
2Usage error, including a paid flag on OSS
4A paid command on OSS, or the commercial package without a licence. validate-sql on the open-source package never returns 4.
On this page