Skip to content

render

Render the final SQL for a model with all templates and macros expanded.

This is useful for debugging template issues and seeing the exact SQL that will be executed.

Output adapts to environment:

  • Terminal: Plain SQL (suitable for syntax highlighting)
  • Piped/Scripted: Markdown with code block

Usage

bash
leapsql render <model>

Global Options

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

Examples

bash
# Render a model's SQL
leapsql render staging.stg_customers

# Render and save to file
leapsql render staging.stg_customers > rendered.sql

# Render as JSON
leapsql render staging.stg_customers --output json

# Render as Markdown (with code block)
leapsql render staging.stg_customers --output markdown

Released under the MIT License.