dbt environment runner with Snowflake zero-copy clone sandboxes
Project description
dbts
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
-
Add a
sandbox:target to~/.dbt/profiles.yml(alongside your existingdev,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
-
Create your clone:
dbts up --from staging
-
Run dbt against it:
dbts build my_model dbts test +my_model+
-
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. 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 # offline, fast
dbts plan --select tag:slow --exclude path:models/intermediate
dbts plan my_model+ --target live --cost # + Snowflake cost breakdown
By default the command is offline — it parses the dbt project but never connects to Snowflake. Output groups models by directory and shows materialization, tags, and parent count per model. The footer prints suggested --exclude path:<dir> and --exclude tag:<name> snippets sized by how many models each would prune.
Pass --cost to also estimate Snowflake credits and runtime from SNOWFLAKE.ACCOUNT_USAGE.QUERY_HISTORY. With cost on, each per-model row gets median run and last seen columns (median execution time across recent runs of that model, whatever mode they happened to be in), and the footer adds total credits + USD for an incremental run vs a full refresh, plus a top-5 most expensive list. The default lookback is 7 days; widen with --days 30 (max 365).
Cost estimates require your dbt project to set a structured query_tag containing a model field (HelloFresh's set_query_tag macro is one example) and the connecting role to read SNOWFLAKE.ACCOUNT_USAGE.QUERY_HISTORY. USD figures use $3.00 per credit by default; override with $DBTS_CREDIT_RATE. If access is missing, dbts plan prints a hint and falls back to the offline output.
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:
$DBTS_PROFILEif set.- The
profile:field indbt_project.ymlat 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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dbts-0.5.0.tar.gz.
File metadata
- Download URL: dbts-0.5.0.tar.gz
- Upload date:
- Size: 69.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bcc18a6eb2e60359b3d3dfad045f3175fce3c8cdb84a6b950e05ab204899d423
|
|
| MD5 |
7c33b995e5f947cd2efb272b2baacd69
|
|
| BLAKE2b-256 |
174c7a9257a90282c9410fb87dda740ce0f9de73cb1b7bf77ed39dd194d18894
|
Provenance
The following attestation bundles were made for dbts-0.5.0.tar.gz:
Publisher:
publish.yml on luiul/dbts
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dbts-0.5.0.tar.gz -
Subject digest:
bcc18a6eb2e60359b3d3dfad045f3175fce3c8cdb84a6b950e05ab204899d423 - Sigstore transparency entry: 1511296086
- Sigstore integration time:
-
Permalink:
luiul/dbts@0acb20d4a90c09aa1f58200081b59a3048d98c4c -
Branch / Tag:
refs/tags/v0.5.0 - Owner: https://github.com/luiul
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@0acb20d4a90c09aa1f58200081b59a3048d98c4c -
Trigger Event:
release
-
Statement type:
File details
Details for the file dbts-0.5.0-py3-none-any.whl.
File metadata
- Download URL: dbts-0.5.0-py3-none-any.whl
- Upload date:
- Size: 22.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a0ba8e4f3af34ca7380296a0c1cf3d95b290c247c899e152fa39ab2a8055473f
|
|
| MD5 |
34bde1c23bbcf08f1468fb5a55262b15
|
|
| BLAKE2b-256 |
8e8f8ed740237ce86ce02e9ea23ddb1147f633fb25b341be2ccc10473b1ae75a
|
Provenance
The following attestation bundles were made for dbts-0.5.0-py3-none-any.whl:
Publisher:
publish.yml on luiul/dbts
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dbts-0.5.0-py3-none-any.whl -
Subject digest:
a0ba8e4f3af34ca7380296a0c1cf3d95b290c247c899e152fa39ab2a8055473f - Sigstore transparency entry: 1511296198
- Sigstore integration time:
-
Permalink:
luiul/dbts@0acb20d4a90c09aa1f58200081b59a3048d98c4c -
Branch / Tag:
refs/tags/v0.5.0 - Owner: https://github.com/luiul
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@0acb20d4a90c09aa1f58200081b59a3048d98c4c -
Trigger Event:
release
-
Statement type: