CLI Reference
LeapSQL provides a command-line interface for running models, managing seeds, and inspecting your data transformation pipeline.
Installation
bash
go install github.com/leapstack-labs/leapsql/cmd/leapsql@latestBasic Usage
bash
leapsql <command> [options]Commands
| Command | Description |
|---|---|
completion | Generate shell completion scripts |
dag | Show the dependency graph |
discover | Index macros and models for IDE features |
doctor | Run a comprehensive project health check |
init | Initialize a new LeapSQL project |
lineage | Show lineage for a model |
lint | Run lint rules on SQL models |
list | List all models and their dependencies |
lsp | Start the Language Server Protocol server |
query | Query the state database |
render | Render SQL for a model with templates expanded |
rules | List available lint rules |
run | Run all models or specific models |
seed | Load seed data from CSV files |
ui | Start the LeapSQL development UI |
version | Show version information |
Global Options
These flags are available for all commands:
| Option | Short | Default | Description |
|---|---|---|---|
--config | config file (default: ./leapsql.yaml) | ||
--database | Path to DuckDB database (empty for in-memory) | ||
--env | Environment name | ||
--macros-dir | Path to macros directory | ||
--models-dir | Path to models directory | ||
--output | -o | Output format (auto|text|markdown|json) | |
--project-dir | -C | Project root directory (auto-detected from models-dir or config file location) | |
--seeds-dir | Path to seeds directory | ||
--state | Path to state database | ||
--target | -t | Target environment to use (e.g., dev, staging, prod) | |
--verbose | -v | false | Verbose output |
Environment Variables
LeapSQL respects these environment variables:
| Variable | Description |
|---|---|
LEAPSQL_MODELS_DIR | Default models directory |
LEAPSQL_SEEDS_DIR | Default seeds directory |
LEAPSQL_MACROS_DIR | Default macros directory |
LEAPSQL_DATABASE | Default database path |
LEAPSQL_STATE_PATH | Default state database path |
LEAPSQL_ENVIRONMENT | Default environment name |
Command-line flags take precedence over environment variables.
Exit Codes
| Code | Meaning |
|---|---|
0 | Success |
1 | Error (check stderr for details) |
Getting Help
bash
# General help
leapsql help
leapsql --help
# Command-specific help
leapsql run --help