Skip to content

Configuration

LeapSQL is configured via leapsql.yaml in your project root.

Project Settings

Directory paths for project assets:

FieldTypeDefaultDescription
models_dirstringmodelsPath to models directory
seeds_dirstringseedsPath to seeds directory
macros_dirstringmacrosPath to macros directory

Target Configuration

Database targets are defined under the targets key. Each target specifies how to connect to a database.

Common Options

FieldTypeRequiredDescription
typestringYesDatabase type: duckdb, postgres, snowflake, bigquery
schemastringNoDefault schema for models

DuckDB

DuckDB is an embedded analytical database. It can run in-memory or persist to a file.

FieldTypeDescription
databasestringFile path (DuckDB) or database name

DuckDB Example

yaml
targets:
  dev:
    type: duckdb
    database: ./data/warehouse.duckdb
    schema: main

  # In-memory DuckDB (default)
  memory:
    type: duckdb
    schema: main

PostgreSQL

PostgreSQL connection options:

FieldTypeDefaultDescription
hoststring-Database host
portint5432Database port
userstring-Database username
passwordstring-Database password

PostgreSQL Example

yaml
targets:
  prod:
    type: postgres
    host: localhost
    port: 5432
    user: analytics
    password: ${POSTGRES_PASSWORD}
    database: warehouse
    schema: analytics

Snowflake

Snowflake-specific connection options:

FieldTypeDescription
accountstringSnowflake account identifier
warehousestringSnowflake warehouse name
rolestringSnowflake role to use

Snowflake Example

yaml
targets:
  prod:
    type: snowflake
    account: xy12345.us-east-1
    user: ${SNOWFLAKE_USER}
    password: ${SNOWFLAKE_PASSWORD}
    database: ANALYTICS
    warehouse: COMPUTE_WH
    role: ANALYTICS_ROLE
    schema: PUBLIC

Full Configuration Example

yaml
# LeapSQL Configuration
# leapsql.yaml

# Project directories
models_dir: models
seeds_dir: seeds
macros_dir: macros

# Default target to use
default_target: dev

# Database targets
targets:
  dev:
    type: duckdb
    database: ./data/dev.duckdb
    schema: main
    params:
      extensions:
        - httpfs
        - parquet

  staging:
    type: postgres
    host: staging-db.example.com
    port: 5432
    user: leapsql
    password: ${STAGING_DB_PASSWORD}
    database: analytics
    schema: staging

  prod:
    type: postgres
    host: prod-db.example.com
    port: 5432
    user: leapsql
    password: ${PROD_DB_PASSWORD}
    database: analytics
    schema: public

Environment Variables

Use ${VAR_NAME} syntax to reference environment variables in your configuration:

yaml
targets:
  prod:
    type: postgres
    password: ${POSTGRES_PASSWORD}

Released under the MIT License.