-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[docs] add dbt code references guide (#22318)
## Summary Brief expansion of the code references guide to include info on generating dbt code references. ## Test Plan vercel
- Loading branch information
Showing
6 changed files
with
74 additions
and
1 deletion.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
...es/docs_snippets/docs_snippets/guides/dagster/code_references/with_dbt_code_references.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
from pathlib import Path | ||
|
||
from dagster_dbt import ( | ||
DagsterDbtTranslator, | ||
DagsterDbtTranslatorSettings, | ||
DbtCliResource, | ||
DbtProject, | ||
dbt_assets, | ||
) | ||
|
||
from dagster import AssetExecutionContext, Definitions, with_source_code_references | ||
|
||
my_project = DbtProject(project_dir=Path("path/to/dbt_project")) | ||
|
||
# links to dbt model source code from assets | ||
dagster_dbt_translator = DagsterDbtTranslator( | ||
settings=DagsterDbtTranslatorSettings(enable_code_references=True) | ||
) | ||
|
||
|
||
@dbt_assets( | ||
manifest=my_project.manifest_path, | ||
dagster_dbt_translator=dagster_dbt_translator, | ||
project=my_project, | ||
) | ||
def my_dbt_assets(context: AssetExecutionContext, dbt: DbtCliResource): | ||
yield from dbt.cli(["build"], context=context).stream() | ||
|
||
|
||
defs = Definitions(assets=with_source_code_references([my_dbt_assets])) |
4b30462
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Deploy preview for dagster-docs ready!
✅ Preview
https://dagster-docs-j4y6k03m7-elementl.vercel.app
https://master.dagster.dagster-docs.io
Built with commit 4b30462.
This pull request is being automatically deployed with vercel-action