Skip to main content

dbt environment runner with Snowflake zero-copy clone sandboxes

Project description

dbts

PyPI Python CI License: MIT

dbt environment runner with Snowflake zero-copy clone sandboxes.

dbts lets you run dbt against a private, per-developer Snowflake clone of your staging or live database — without managing a separate set of credentials, profile files, or CLIs. It also acts as a single front for running dbt against your shared dev, staging, and live targets.

Install

uv tool install dbts
# or run ad hoc:
uvx dbts ...

Quick start

  1. Add a sandbox: target to ~/.dbt/profiles.yml (alongside your existing dev, staging, live):

    tardis_snowflake:
      outputs:
        sandbox:
          type: snowflake
          account: <same as the other targets>
          user: <same as the other targets>
          role: <same as the other targets>
          authenticator: externalbrowser
          database: scm_analytics_sandbox_<your_username>
          warehouse: <same as the other targets>
          schema: raw_data_vault
    
  2. Create your clone:

    dbts up --from staging
    
  3. Run dbt against it:

    dbts build my_model
    dbts test  +my_model+
    
  4. Refresh or drop when done:

    dbts refresh --from staging
    dbts drop
    

Commands

dbts up      --from staging|live   create the clone
dbts refresh --from staging|live   drop and re-create the clone
dbts status                        show clone DB, source, age
dbts drop                          drop the clone

dbts build|run|test|compile|...    pass through to dbt (default --target sandbox)
  --target sandbox|staging|live|dev   choose target

dbts version                       print installed version

Global flags: -v / --verbose (debug logging, including DDL), -q / --quiet (warnings only). -h is a shorthand for --help.

Selectors

Bare positional model selectors work the same as in dbt:

dbts build my_model+              # forwarded as `--select my_model+`
dbts test +my_model+              # ancestors and descendants
dbts run a b c+                   # multi-selector union
dbts build my_model+ --exclude experiments
dbts build --select a b           # `--select` + bare positional are merged

Internally, bare positional args on run / build / test / compile / seed / snapshot / ls / show are promoted to a --select value before being forwarded to dbt. Other subcommands (debug, deps, docs, parse, clean, source) pass arguments through verbatim.

Previewing a build

dbts plan lists exactly which models a dbts build (or run/test/...) with the same selectors would touch — without connecting to Snowflake or running anything. Useful when a build against --target live blows up halfway and you need to add --exclude rules.

dbts plan my_model+ another_model+ --target live
dbts plan --select tag:slow --exclude path:models/intermediate

The output groups models by directory, shows materialization and tags per model, and prints a footer of suggested --exclude path:<dir> and --exclude tag:<name> snippets so you can copy-paste them straight into the corresponding dbts build invocation.

Project-side coupling

dbts assumes the dbt project's generate_database_name macro recognises ENV=sandbox and routes models into a _SANDBOX_<USER> suffixed database. See the dbt project's README for the macro snippet.

Profile resolution

dbts resolves the dbt profile name in this order:

  1. $DBTS_PROFILE if set.
  2. The profile: field in dbt_project.yml at the project root.

Jinja {{ env_var('NAME', 'default') }} calls in the profile: field are rendered against the current environment, so projects whose profile name is templated (e.g. tardis_{{ env_var('warehouse', 'snowflake') }}) work out of the box.

Development

uv sync --group dev
uv run pytest
prek install   # one-time, runs ruff + ty on every commit

prek (Astral's Rust port of pre-commit) is the recommended runner for the hooks defined in .pre-commit-config.yaml. Install it via brew install prek or uv tool install prek. The standard pre-commit binary works just as well if you'd rather use it.

Cutting a release (after moving [Unreleased] entries under a [X.Y.Z] heading in CHANGELOG.md):

./scripts/release.sh 0.4.0

The script bumps pyproject.toml, syncs the lockfile, runs the full check suite, commits, tags, pushes, and creates the GitHub release with notes pulled from CHANGELOG.md.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dbts-0.4.0.tar.gz (59.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dbts-0.4.0-py3-none-any.whl (15.7 kB view details)

Uploaded Python 3

File details

Details for the file dbts-0.4.0.tar.gz.

File metadata

  • Download URL: dbts-0.4.0.tar.gz
  • Upload date:
  • Size: 59.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for dbts-0.4.0.tar.gz
Algorithm Hash digest
SHA256 41c6f7a4a7123b7bd8bcb52175b87c9ed834b8a5f5a9234f11df7ef9f66b659a
MD5 e6d268224415de44eaa5499e22332f3b
BLAKE2b-256 587dfd41520c93675fedc137fd2a35357a92b4f033d82508caefe9a38e02c1e1

See more details on using hashes here.

Provenance

The following attestation bundles were made for dbts-0.4.0.tar.gz:

Publisher: publish.yml on luiul/dbts

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file dbts-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: dbts-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 15.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for dbts-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6c1b9b4c8dcf0e86abd18e75bd9cc79953da6d6e6cf4e0b93198a7fd13ef7913
MD5 d6a4da6aa7a8e1961e87665973f30665
BLAKE2b-256 0e1325a2a3f8a15c5bff79ec878004cb723272e896abb65400ba3cb21042ad4f

See more details on using hashes here.

Provenance

The following attestation bundles were made for dbts-0.4.0-py3-none-any.whl:

Publisher: publish.yml on luiul/dbts

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page