Install & Compatibility
Where this runs
tested against v0.6.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 19.2MB
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 1.6s · import 0.000s · 19MB
17MB installed
● package 17MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
extract_from_source
✓ from dbt_extractor import extract_from_source
✗ from dbt_extractor.main import extract_from_source
This quickstart demonstrates how to use `dbt-extractor` to parse a dbt model's SQL content and extract references to other models (`ref`), sources (`source`), and configurations (`config`). If the extraction is not 100% certain, an `ExtractionError` will be raised.
from dbt_extractor.main import extract_from_source
from dbt_extractor.extractor import ExtractionError
dbt_model_content = """
SELECT
{{ ref('my_model') }} as model_data,
{{ source('my_schema', 'my_table') }} as source_data,
{{ config(materialized='table') }}
FROM some_table
"""
try:
extracted_data = extract_from_source(dbt_model_content)
print("Extracted Refs:", extracted_data.refs)
print("Extracted Sources:", extracted_data.sources)
print("Extracted Configs:", extracted_data.configs)
except ExtractionError as e:
print(f"Extraction failed: {e}")
Debug
Known issues
gotchaInstallation of `dbt-extractor` requires a Rust toolchain (specifically `cargo`) to compile its underlying components. Users without Rust installed will encounter build errors during `pip install`.fixInstall Rust and Cargo via `rustup.rs` or your system's package manager before installing `dbt-extractor`.
affects: All versions
gotchaThe library's core strategy is to be 100% certain about its extractions. If it encounters Jinja it cannot confidently parse and extract, it will raise an `ExtractionError` instead of returning potentially incomplete or incorrect results. This means some valid dbt Jinja might not be processed by `dbt-extractor` and may require alternative rendering.fixBe prepared to handle `ExtractionError` and consider fallback mechanisms (e.g., dbt's native Jinja rendering) for complex or unsupported Jinja patterns.
affects: All versions
gotcha`dbt-extractor` focuses on Jinja syntax extraction and does not perform validation of the underlying SQL syntax, schema existence, or data types. Errors in these areas will not be caught by `dbt-extractor` during compilation and will only manifest at runtime when dbt executes the SQL against your data warehouse.fixSupplement `dbt-extractor` usage with other tools like SQL linters (e.g., SQLFluff) and comprehensive dbt tests to ensure SQL correctness and data integrity.
affects: All versions
bugThere is an open bug where installation fails on free-threaded Python 3.14t, reporting an `ImportError: DLL load failed while importing dbt_extractor`.fixAvoid using free-threaded Python 3.14t or newer versions until this issue is resolved. Stick to officially supported Python versions (currently `>=3.9`).
affects: 0.6.0 (and potentially earlier) on Python 3.14t
Upgrade
Version history
0.6.0latest on PyPI · released Apr 7, 2025
Audit
Dependencies
No dependency data recorded yet.