Skip to content

Commit

Permalink
test(dbt): assert correct owners when using dbt config inheritance (#…
Browse files Browse the repository at this point in the history
…20998)

## Summary & Motivation
Just add a test to make sure this is working.

## How I Tested These Changes
pytest
  • Loading branch information
rexledesma authored Apr 3, 2024
1 parent 3e860bf commit 9ad6b22
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -629,13 +629,13 @@ def my_dbt_assets(): ...
# If a model has a Dagster group name specified under `meta`, use that.
AssetKey(["customized", "staging", "customers"]): "customized_dagster_group",
# If a model has a dbt group name specified under `group`, use that.
AssetKey(["customized", "staging", "orders"]): "customized_dbt_group",
AssetKey(["customized", "staging", "orders"]): "customized_dbt_model_group",
# If a model has both a Dagster group and dbt group, use the Dagster group.
AssetKey(["customized", "staging", "payments"]): "customized_dagster_group",
AssetKey(["orders"]): "default",
AssetKey(["raw_customers"]): "default",
AssetKey(["raw_orders"]): "default",
AssetKey(["raw_payments"]): "default",
AssetKey(["raw_customers"]): "customized_dbt_seed_group",
AssetKey(["raw_orders"]): "customized_dbt_seed_group",
AssetKey(["raw_payments"]): "customized_dbt_seed_group",
}


Expand All @@ -649,7 +649,8 @@ def my_dbt_assets(): ...


def test_dbt_meta_owners(test_meta_config_manifest: Dict[str, Any]) -> None:
expected_dbt_owners = [UserAssetOwner("[email protected]")]
expected_dbt_model_owners = [UserAssetOwner("[email protected]")]
expected_dbt_seed_owners = [UserAssetOwner("[email protected]")]
expected_dagster_owners = [UserAssetOwner("[email protected]")]

@dbt_assets(manifest=test_meta_config_manifest)
Expand All @@ -660,13 +661,13 @@ def my_dbt_assets(): ...
# If a model has Dagster owners specified under `meta`, use that.
AssetKey(["customized", "staging", "customers"]): [],
# If a model has a dbt owner specified under `group`, use that.
AssetKey(["customized", "staging", "orders"]): expected_dbt_owners,
AssetKey(["customized", "staging", "orders"]): expected_dbt_model_owners,
# If a model has both Dagster owners and a dbt owner, use the Dagster owner.
AssetKey(["customized", "staging", "payments"]): expected_dagster_owners,
AssetKey(["orders"]): [],
AssetKey(["raw_customers"]): [],
AssetKey(["raw_orders"]): [],
AssetKey(["raw_payments"]): [],
AssetKey(["raw_customers"]): expected_dbt_seed_owners,
AssetKey(["raw_orders"]): expected_dbt_seed_owners,
AssetKey(["raw_payments"]): expected_dbt_seed_owners,
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ require-dbt-version: [">=1.0.0", "<2.0.0"]
seeds:
+docs:
node_color: "#cd7f32"
+group: customized_dbt_seed_group

models:
test_dagster_meta_config:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: 2

groups:
- name: customized_dbt_group
- name: customized_dbt_model_group
owner:
name: Karl Rossmann
email: [email protected]
Expand All @@ -21,7 +21,7 @@ models:

- name: stg_orders
config:
group: customized_dbt_group
group: customized_dbt_model_group
meta:
dagster:
asset_key: ["customized", "staging", "orders"]
Expand All @@ -38,7 +38,7 @@ models:

- name: stg_payments
config:
group: customized_dbt_group
group: customized_dbt_model_group
meta:
dagster:
asset_key: ["customized", "staging", "payments"]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
groups:
- name: customized_dbt_seed_group
owner:
name: Georg Bendemann
email: [email protected]

0 comments on commit 9ad6b22

Please sign in to comment.