{"id":19807361,"url":"https://github.com/dbt-labs/dbt-extractor","last_synced_at":"2025-05-01T07:31:38.333Z","repository":{"id":38330326,"uuid":"346855208","full_name":"dbt-labs/dbt-extractor","owner":"dbt-labs","description":null,"archived":false,"fork":false,"pushed_at":"2024-06-14T14:21:28.000Z","size":2644,"stargazers_count":26,"open_issues_count":15,"forks_count":6,"subscribers_count":9,"default_branch":"main","last_synced_at":"2024-10-30T05:42:45.191Z","etag":null,"topics":["dbt","jinja2","parser"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dbt-labs.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-03-11T22:21:32.000Z","updated_at":"2024-08-20T03:39:39.000Z","dependencies_parsed_at":"2023-12-13T16:46:47.064Z","dependency_job_id":"18f9e70c-2527-4bdd-bac2-4446ca24e441","html_url":"https://github.com/dbt-labs/dbt-extractor","commit_stats":{"total_commits":309,"total_committers":6,"mean_commits":51.5,"dds":0.06148867313915862,"last_synced_commit":"5592c5fda865de8366b3071bf16e91864b92d260"},"previous_names":["dbt-labs/dbt-parser-generator"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dbt-labs%2Fdbt-extractor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dbt-labs%2Fdbt-extractor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dbt-labs%2Fdbt-extractor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dbt-labs%2Fdbt-extractor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dbt-labs","download_url":"https://codeload.github.com/dbt-labs/dbt-extractor/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224245997,"owners_count":17279649,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dbt","jinja2","parser"],"created_at":"2024-11-12T09:10:20.568Z","updated_at":"2024-11-12T09:10:21.166Z","avatar_url":"https://github.com/dbt-labs.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# dbt extractor\n## Understanding dbt-extractor\n\nThis repository contains a tool that processes the most common jinja value templates in dbt model files. The tool depends on tree-sitter and the tree-sitter-jinja2 library.\n\n![demo app](demo/demo.gif)\n\n## Getting started\n\n- Read the [introduction](https://docs.getdbt.com/docs/introduction/) and [viewpoint](https://docs.getdbt.com/docs/about/viewpoint/) of dbt\n\n## Strategy\n\nThe current strategy is for this processor to be 100% certain when it can accurately extract values from a given model file. Anything less than 100% certainty returns an exception so that the model can be rendered with python Jinja instead. \n\nThere are two cases we want to avoid because they would risk correctness to user's projects:\n1. Confidently extracting values that would not be extracted by python jinja (false positives)\n2. Confidently extracting a set of values that are missing values that python jinja would have extracted. (misses)\n\nIf we instead error when we could have confidently extracted values, there is no correctness risk to the user. Only an opportunity to expand the rules to encompass this class of cases as well.\n\nEven though jinja in dbt is not a typed language, the type checker statically determines whether or not the current implementation can confidently extract values without relying on python jinja rendering, which is when these errors would otherwise surface. This type checker will become more permissive over time as this tool expands to include more dbt and jinja features.\n\n## Architecture\n\nThis architecture is optimized for value extraction and for future flexibility. This architecture is expected to change, and is coded in fp-style stages to make those changes easier for the future.\n\nThis processor is composed of several stages:\n1. parser\n2. type checker\n3. extractor\n\nAdditionally, the following tools utilize the above processor:\n1. browser-based demo of dbt extraction as you type\n\nThe tree-sitter parser is located in the tree-sitter-jinja2 library. The rust bindings are used to traverse the concrete syntax tree that tree-sitter creates in order to create a typed abstract syntax tree in the type checking stage. The errors in the type checking stage are not raised to the user, and are instead used by developers to debug tests.\n\nThe parser is solely responsible for turning text into recognized values, while the type checker does arity checking, and enforces argument list types (e.g. nested function calls like `{{ config(my_ref=ref('table')) }}` will parse but not type check even though it is valid dbt syntax. The tool at this time doesn't have an agreed serialization to communicate refs as config values, but could in the future.)\n\nThe extractor uses the typed abstract syntax tree to easily identify all the refs, sources, and configs present and extract them.\n\n## Join the dbt Community\n\n- Be part of the conversation in the [dbt Community Slack](http://community.getdbt.com/)\n- Read more on the [dbt Community Discourse](https://discourse.getdbt.com)\n\n## Reporting bugs and contributing code\n\n- Want to report a bug or request a feature? Let us know on [Slack](http://community.getdbt.com/), or open [an issue](https://github.com/dbt-labs/dbt-extractor/issues/new)\n- Want to help us build `dbt-extractor`? Check out the [Contributing Guide](https://github.com/dbt-labs/dbt-extractor/blob/HEAD/CONTRIBUTING.md)\n\n## Code of Conduct\n\nEveryone interacting in the dbt project's codebases, issue trackers, chat rooms, and mailing lists is expected to follow the [dbt Code of Conduct](https://community.getdbt.com/code-of-conduct).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdbt-labs%2Fdbt-extractor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdbt-labs%2Fdbt-extractor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdbt-labs%2Fdbt-extractor/lists"}