Command Line Interface¶
SQLSpec includes a CLI for managing migrations and inspecting configuration. Use it when you want a fast, explicit workflow without additional tooling.
Configuration can come from --config, SQLSPEC_CONFIG, or
[tool.sqlspec] in pyproject.toml.
Core Commands¶
sqlspec init
sqlspec create-migration -m "add users"
sqlspec upgrade
sqlspec downgrade
Common Options¶
--bind-keytargets a specific database configuration.--no-promptskips confirmation prompts.--formatselects SQL vs Python migration files.--use-loggeremits migration output via structured logger.--no-echodisables console output for migration commands.--summaryemits a single summary log entry when logger output is enabled.
Tips¶
Run
sqlspec --helpto see global options.Run
sqlspec upgrade --helpto see command-specific migration options.