You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- change variable name `dbt_project` to `jaffle_shop_project` in code snippets
- add `packaged_project_dir` parameter to `DbtProject` - this parameter is automatically added by the `dagster-dbt project scaffold` command
- update `downstream-assets.md` and `load-dbt-models.md`
Copy file name to clipboardExpand all lines: docs/docs/integrations/libraries/dbt/using-dbt-with-dagster/downstream-assets.md
+2-2
Original file line number
Diff line number
Diff line change
@@ -22,7 +22,7 @@ pip install plotly
22
22
23
23
You've added upstream assets to your data pipeline, but nothing downstream - until now. In this step, you'll define a Dagster asset called `order_count_chart` that uses the data in the `customers` dbt model to computes a plotly chart of the number of orders per customer.
24
24
25
-
Like the `raw_customers` asset that we added in the [previous section](upstream-assets#step-2-define-an-upstream-dagster-asset), we'll put this asset in our `definitions.py` file, inside the `jaffle_dagster` directory.
25
+
Like the `raw_customers` asset that we added in the [previous section](upstream-assets#step-2-define-an-upstream-dagster-asset), we'll put this asset in our `assets.py` file, inside the `jaffle_dagster` directory.
26
26
27
27
To add the `order_count_chart` asset:
28
28
@@ -38,7 +38,7 @@ To add the `order_count_chart` asset:
38
38
39
39
This asset definition looks similar the asset we defined in the previous section. In this case, instead of fetching data from an external source and writing it to DuckDB, it reads data from DuckDB, and then uses it to make a plot.
40
40
41
-
The line `deps=get_asset_key_for_model([jaffle_shop_dbt_assets], "customers")` tells Dagster that this asset is downstream of the `customers` dbt model. This dependency will be displayed as such in Dagster's UI. If you launch a run to materialize both of them, Dagster won't run `order_count_chart` until `customers` completes.
41
+
The line `deps=[get_asset_key_for_model([jaffle_shop_dbt_assets], "customers")]` tells Dagster that this asset is downstream of the `customers` dbt model. This dependency will be displayed as such in Dagster's UI. If you launch a run to materialize both of them, Dagster won't run `order_count_chart` until `customers` completes.
42
42
43
43
3. Add the `order_count_chart` to the `Definitions`:
Copy file name to clipboardExpand all lines: docs/docs/integrations/libraries/dbt/using-dbt-with-dagster/load-dbt-models.md
+4-4
Original file line number
Diff line number
Diff line change
@@ -74,19 +74,19 @@ The most important file is the Python file that contains the set of definitions
74
74
75
75
In our `definitions.py` Python file, we import from `assets.py`, which contains the code to model our dbt models as Dagster assets. To return a Dagster asset for each dbt model, the code in this `assets.py` file needs to know what dbt models you have. It finds out what models you have by reading a file called a `manifest.json`, which is a file that dbt can generate for any dbt project and contains information about every model, seed, snapshot, test, etc. in the project.
76
76
77
-
To retrieve the `manifest.json`, `assets.py` imports from `project.py`, which defines an internal representation of your dbt project. Then, in `assets.py`, the path to the `manifest.json` file can be accessed with `dbt_project.manifest_path`:
77
+
To retrieve the `manifest.json`, `assets.py` imports from `project.py`, which defines an internal representation of your dbt project. Then, in `assets.py`, the path to the `manifest.json` file can be accessed with `jaffle_shop_project.manifest_path`:
Generating the `manifest.json` file for a dbt project is time-consuming, so it's best to avoid doing so every time this Python module is imported. Thus, in production deployments of Dagster, you'll typically have the CI/CD system that packages up your code generate your `manifest.json`.
82
82
83
83
However, in development, you typically want changes made to files in your dbt project to be immediately reflected in the Dagster UI without needing to regenerate the manifest.
84
84
85
-
`dbt_project.prepare_if_dev()` helps with this – it re-generates your `manifest.json` at the time Dagster imports your code, _but_ only if it's being imported by the `dagster dev` command.
85
+
`jaffle_shop_project.prepare_if_dev()` helps with this – it re-generates your `manifest.json` at the time Dagster imports your code, _but_ only if it's being imported by the `dagster dev` command.
86
86
87
87
Once you've got a `manifest.json` file, it's time to define your Dagster assets using it. The following code, in your project's `assets.py`, does this:
0 commit comments