Skip to content

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@latest

Basic Usage

bash
leapsql <command> [options]

Commands

CommandDescription
completionGenerate shell completion scripts
dagShow the dependency graph
discoverIndex macros and models for IDE features
doctorRun a comprehensive project health check
initInitialize a new LeapSQL project
lineageShow lineage for a model
lintRun lint rules on SQL models
listList all models and their dependencies
lspStart the Language Server Protocol server
queryQuery the state database
renderRender SQL for a model with templates expanded
rulesList available lint rules
runRun all models or specific models
seedLoad seed data from CSV files
uiStart the LeapSQL development UI
versionShow version information

Global Options

These flags are available for all commands:

OptionShortDefaultDescription
--configconfig file (default: ./leapsql.yaml)
--databasePath to DuckDB database (empty for in-memory)
--envEnvironment name
--macros-dirPath to macros directory
--models-dirPath to models directory
--output-oOutput format (auto|text|markdown|json)
--project-dir-CProject root directory (auto-detected from models-dir or config file location)
--seeds-dirPath to seeds directory
--statePath to state database
--target-tTarget environment to use (e.g., dev, staging, prod)
--verbose-vfalseVerbose output

Environment Variables

LeapSQL respects these environment variables:

VariableDescription
LEAPSQL_MODELS_DIRDefault models directory
LEAPSQL_SEEDS_DIRDefault seeds directory
LEAPSQL_MACROS_DIRDefault macros directory
LEAPSQL_DATABASEDefault database path
LEAPSQL_STATE_PATHDefault state database path
LEAPSQL_ENVIRONMENTDefault environment name

Command-line flags take precedence over environment variables.

Exit Codes

CodeMeaning
0Success
1Error (check stderr for details)

Getting Help

bash
# General help
leapsql help
leapsql --help

# Command-specific help
leapsql run --help

Released under the MIT License.