{"id":855,"library":"dbt-extractor","title":"dbt-extractor","description":"dbt-extractor is a Python library that processes Jinja templates within dbt model files to analyze and extract metadata such as `ref`, `source`, and `config` calls. It is part of the `dbt-labs/dbt-parser-generator` repository. The tool, currently at version 0.6.0, prioritizes 100% certainty in its extraction, raising an exception if it cannot confidently extract values, rather than risking incorrect or incomplete output.","status":"active","version":"0.6.0","language":"python","source_language":"en","source_url":"https://github.com/dbt-labs/dbt-parser-generator/","tags":["dbt","jinja","sql","extractor","parsing","data-modeling"],"install":[{"cmd":"pip install dbt-extractor","lang":"bash","label":"Install with pip"}],"dependencies":[],"imports":[{"wrong":"from dbt_extractor.main import extract_from_source","symbol":"extract_from_source","correct":"from dbt_extractor import extract_from_source"}],"quickstart":{"code":"from dbt_extractor.main import extract_from_source\nfrom dbt_extractor.extractor import ExtractionError\n\ndbt_model_content = \"\"\"\nSELECT\n    {{ ref('my_model') }} as model_data,\n    {{ source('my_schema', 'my_table') }} as source_data,\n    {{ config(materialized='table') }}\nFROM some_table\n\"\"\"\n\ntry:\n    extracted_data = extract_from_source(dbt_model_content)\n    print(\"Extracted Refs:\", extracted_data.refs)\n    print(\"Extracted Sources:\", extracted_data.sources)\n    print(\"Extracted Configs:\", extracted_data.configs)\nexcept ExtractionError as e:\n    print(f\"Extraction failed: {e}\")","lang":"python","description":"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."},"warnings":[{"fix":"Install Rust and Cargo via `rustup.rs` or your system's package manager before installing `dbt-extractor`.","message":"Installation 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`.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Be prepared to handle `ExtractionError` and consider fallback mechanisms (e.g., dbt's native Jinja rendering) for complex or unsupported Jinja patterns.","message":"The 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.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Supplement `dbt-extractor` usage with other tools like SQL linters (e.g., SQLFluff) and comprehensive dbt tests to ensure SQL correctness and data integrity.","message":"`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.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Avoid using free-threaded Python 3.14t or newer versions until this issue is resolved. Stick to officially supported Python versions (currently `>=3.9`).","message":"There is an open bug where installation fails on free-threaded Python 3.14t, reporting an `ImportError: DLL load failed while importing dbt_extractor`.","severity":"bug","affected_versions":"0.6.0 (and potentially earlier) on Python 3.14t"}],"env_vars":null,"search_vec":"'/dbt-parser-generator':39 '0.6.0':46 '100':48 'analyz':20 'call':30 'cannot':58 'certainti':49 'confid':59 'config':29 'current':43 'data':75 'data-model':74 'dbt':2,5,16,37,69 'dbt-extractor':1,4 'dbt-lab':36 'except':55 'extract':22,52,60 'extractor':3,6,72 'file':18 'incomplet':67 'incorrect':65 'jinja':13,70 'lab':38 'librari':10 'metadata':23 'model':17,76 'output':68 'pars':73 'part':33 'priorit':47 'process':12 'python':9 'rais':53 'rather':62 'ref':26 'repositori':40 'risk':64 'sourc':27 'sql':71 'templat':14 'tool':42 'valu':61 'version':45 'within':15","created_at":"2026-03-29T06:04:54.020367+00:00","updated_at":"2026-04-16T05:47:15.886994+00:00","problems":null,"ecosystem":"pypi","meta_description":null,"install_score":0,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"0.6.0","cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/dbt-labs/dbt-parser-generator","docs":null,"changelog":null,"pypi":"https://pypi.org/project/dbt-extractor/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["data","devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-30","last_verified":"2026-08-27","next_check":"2026-07-30","install_tag":"stale"}}