-
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.
Update integrations to use kind tags in place of storage kind (#24324)
## Summary Updates the Fivetran, dbt, sdf, and embedded-elt integrations to use `dagster/kind/xyz` tags in place of compute kind. In particular, brings back kinds for both storage & compute in the UI. ## Test Plan Updated unit tests.
- Loading branch information
Showing
15 changed files
with
60 additions
and
76 deletions.
There are no files selected for viewing
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
17 changes: 16 additions & 1 deletion
17
python_modules/dagster/dagster/_core/definitions/tags/__init__.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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,10 +28,9 @@ | |
asset, | ||
materialize, | ||
) | ||
from dagster._core.definitions.tags import StorageKindTagSet | ||
from dagster._core.definitions.tags import build_kind_tag, has_kind | ||
from dagster._core.definitions.utils import DEFAULT_IO_MANAGER_KEY | ||
from dagster._core.execution.context.compute import AssetExecutionContext | ||
from dagster._core.storage.tags import COMPUTE_KIND_TAG | ||
from dagster._core.types.dagster_type import DagsterType | ||
from dagster_dbt.asset_decorator import dbt_assets | ||
from dagster_dbt.asset_specs import build_dbt_asset_specs | ||
|
@@ -360,7 +359,6 @@ def my_dbt_assets(): ... | |
|
||
assert my_dbt_assets.op.tags == { | ||
**op_tags, | ||
COMPUTE_KIND_TAG: "dbt", | ||
"dagster_dbt/select": "fqn:*", | ||
} | ||
|
||
|
@@ -369,7 +367,6 @@ def my_dbt_assets_with_select(): ... | |
|
||
assert my_dbt_assets_with_select.op.tags == { | ||
**op_tags, | ||
COMPUTE_KIND_TAG: "dbt", | ||
"dagster_dbt/select": "raw_customers+", | ||
} | ||
|
||
|
@@ -378,7 +375,6 @@ def my_dbt_assets_with_exclude(): ... | |
|
||
assert my_dbt_assets_with_exclude.op.tags == { | ||
**op_tags, | ||
COMPUTE_KIND_TAG: "dbt", | ||
"dagster_dbt/select": "fqn:*", | ||
"dagster_dbt/exclude": "raw_customers+", | ||
} | ||
|
@@ -393,7 +389,6 @@ def my_dbt_assets_with_select_and_exclude(): ... | |
|
||
assert my_dbt_assets_with_select_and_exclude.op.tags == { | ||
**op_tags, | ||
COMPUTE_KIND_TAG: "dbt", | ||
"dagster_dbt/select": "raw_customers+", | ||
"dagster_dbt/exclude": "customers", | ||
} | ||
|
@@ -605,46 +600,6 @@ def my_dbt_assets(): ... | |
assert expected_specs_by_key[asset_key].tags["customized"] == "tag" | ||
|
||
|
||
def test_with_storage_kind_tag_override(test_jaffle_shop_manifest: Dict[str, Any]) -> None: | ||
expected_specs_with_no_override_by_key = { | ||
spec.key: spec for spec in build_dbt_asset_specs(manifest=test_jaffle_shop_manifest) | ||
} | ||
|
||
@dbt_assets(manifest=test_jaffle_shop_manifest) | ||
def my_dbt_assets_no_override(): ... | ||
|
||
for asset_key, tags in my_dbt_assets_no_override.tags_by_key.items(): | ||
assert tags["dagster/storage_kind"] == "duckdb" | ||
assert ( | ||
expected_specs_with_no_override_by_key[asset_key].tags["dagster/storage_kind"] | ||
== "duckdb" | ||
) | ||
|
||
class CustomDagsterDbtTranslator(DagsterDbtTranslator): | ||
def get_tags(self, _: Mapping[str, Any]) -> Mapping[str, str]: | ||
return {**StorageKindTagSet(storage_kind="my_custom_storage_kind")} | ||
|
||
expected_specs_by_key = { | ||
spec.key: spec | ||
for spec in build_dbt_asset_specs( | ||
manifest=test_jaffle_shop_manifest, | ||
dagster_dbt_translator=CustomDagsterDbtTranslator(), | ||
) | ||
} | ||
|
||
@dbt_assets( | ||
manifest=test_jaffle_shop_manifest, dagster_dbt_translator=CustomDagsterDbtTranslator() | ||
) | ||
def my_dbt_assets(): ... | ||
|
||
for asset_key, tags in my_dbt_assets.tags_by_key.items(): | ||
assert tags["dagster/storage_kind"] == "my_custom_storage_kind" | ||
assert ( | ||
expected_specs_by_key[asset_key].tags["dagster/storage_kind"] | ||
== "my_custom_storage_kind" | ||
) | ||
|
||
|
||
def test_with_owner_replacements(test_jaffle_shop_manifest: Dict[str, Any]) -> None: | ||
expected_owners = ["[email protected]"] | ||
|
||
|
@@ -883,19 +838,20 @@ def my_dbt_assets(): ... | |
assert expected_specs_by_key[AssetKey("customers")].tags == { | ||
"foo": "", | ||
"bar-baz": "", | ||
"dagster/kind/dbt": "", | ||
**StorageKindTagSet(storage_kind="duckdb"), | ||
**build_kind_tag("duckdb"), | ||
**build_kind_tag("dbt"), | ||
} | ||
assert my_dbt_assets.tags_by_key[AssetKey("customers")] == { | ||
"foo": "", | ||
"bar-baz": "", | ||
**StorageKindTagSet(storage_kind="duckdb"), | ||
**build_kind_tag("duckdb"), | ||
**build_kind_tag("dbt"), | ||
} | ||
for asset_key in my_dbt_assets.keys - {AssetKey("customers")}: | ||
assert my_dbt_assets.tags_by_key[asset_key] == {**StorageKindTagSet(storage_kind="duckdb")} | ||
assert has_kind(my_dbt_assets.tags_by_key[asset_key], "duckdb") | ||
assert expected_specs_by_key[asset_key].tags == { | ||
**StorageKindTagSet(storage_kind="duckdb"), | ||
"dagster/kind/dbt": "", | ||
**build_kind_tag("duckdb"), | ||
**build_kind_tag("dbt"), | ||
} | ||
|
||
|
||
|
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
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
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
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
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