Skip to main content

sofe-dbt

ESLint for your data pipelines. FinOps policies as code for dbt projects — with the real Athena bill attached to every model.

sofe-dbt reads your dbt artifacts (manifest.json, run_results.json, catalog.json) plus real Athena query statistics, and evaluates FinOps policies against your models. It's built on the SOFE engine — SOFE is ESLint for your cloud; sofe-dbt is ESLint for your data pipelines.

$ sofe-dbt check ./
✓ partition-required ...... 42/42 models
⚠ zombie-model ........... stg_legacy_orders (0 consumers)
✗ full-refresh-in-prod ... fct_events (scans 1.2TB daily)
✗ freshness-test-missing . src_salesforce

# 2 errors → PR blocked. Estimated savings: -$380/mo if fixed

Why

Data engineers using dbt know what their models do, whether they pass tests, and whether freshness is met — but they have zero visibility into cost efficiency: how much each model costs, whether materialization is optimal, which models are zombies, and which large tables scan full data on every query.

sofe-dbt closes that gap. Every dollar shown is derived from real Athena DataScannedInBytes — never a heuristic, never invented.

Install

pip install sofe-dbt

Quick start

# 1. Generate dbt artifacts (writes real Athena scan stats into run_results.json)
dbt build

# 2. Evaluate FinOps policies with real cost per model
sofe-dbt check .

# 3. Gate a PR in CI (exit 1 on high-severity findings)
sofe-dbt check . --fail-on high

Live Athena cost enrichment (optional, needs AWS creds):

sofe-dbt check . --profile my-aws-profile

The 10 policies

Policy Severity Category
dbt-small-table-should-be-view medium cost
dbt-long-run-not-incremental high cost
dbt-large-table-no-partition high cost
dbt-zombie-model-no-consumers medium governance
dbt-high-blast-radius-no-tests critical reliability
dbt-ephemeral-over-referenced medium cost
dbt-model-no-description low governance
dbt-model-last-run-failed high reliability
dbt-full-refresh-in-prod critical cost
dbt-freshness-test-missing medium reliability

Real cost, not estimates

Cost per model comes from real Athena bytes scanned:

  • Offline (CI): dbt-athena writes data_scanned_in_bytes into run_results.json at dbt build time.
  • Live: Athena GetQueryExecution → QueryExecutionStatistics.DataScannedInBytes.
cost_per_run = max(bytes_scanned, 10 MB) / 1e12 × $5.00/TB   (us-east-1 on-demand)

If real bytes aren't available, sofe-dbt reports cost: unknown — it does not guess.

Reproducible demo

See GUIDE.md for an end-to-end walkthrough: deploy the AWS stack (CDK: S3 + Glue + Athena), load golden data, run dbt build against real Athena, and see sofe-dbt check surface real cost per model. The whole demo costs cents and tears down with cdk destroy.

Setup (development)

uv venv --python 3.12 .venv
source .venv/bin/activate
uv pip install -e ".[dev]"
pytest

License

Apache-2.0

Metadata

Release files for sofe-dbt 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sofe-dbt 0.1.0
File Size Uploaded
sofe_dbt-0.1.0.tar.gz 18.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for sofe-dbt 0.1.0
File Interpreter ABI Platform
sofe_dbt-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 38.2 kB

Release files / sofe_dbt-0.1.0.tar.gz

Download URL sofe_dbt-0.1.0.tar.gz
Size 18.5 kB
Tags Source
SHA-256 checksum
How to use checksums
5f08acd9412de4a375b060a9cf053a80e2357027f7b258f83716e12b44b46c1e
BLAKE2b-256 checksum
How to use checksums
be1ceb03c572cd3fd860dab4cd6b7384326c9d3b03d9811728718a32a6cad94d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.17

Release files / sofe_dbt-0.1.0-py3-none-any.whl

Download URL sofe_dbt-0.1.0-py3-none-any.whl
Size 19.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ea445b3cb1915620ba8a2f337edcfb760230d6aef4f935335f989492f507372a
BLAKE2b-256 checksum
How to use checksums
4558e3f81bc5779382645b0fdf0edf446995bc49cac7aec6f411c02f0762f2a4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.17

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page