Skip to content

Commit

Permalink
refactor(dbt): rename test_dagster_metadata to `test_dagster_meta_c…
Browse files Browse the repository at this point in the history
…onfig` (#19546)

## Summary & Motivation
Clarify that this project is testing dbt `+meta` config, rather than
metadata emission.

We'll use the old name for this project to actually test metadata
emission.

## How I Tested These Changes
bk
  • Loading branch information
rexledesma authored Feb 12, 2024
1 parent c2222ce commit afceff5
Show file tree
Hide file tree
Showing 21 changed files with 24 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@


test_dagster_metadata_dbt_project_path = (
Path(__file__).joinpath("..", "..", "dbt_projects", "test_dagster_metadata").resolve()
Path(__file__).joinpath("..", "..", "dbt_projects", "test_dagster_meta_config").resolve()
)

runner = CliRunner()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "test_dagster_metadata"
name: "test_dagster_meta_config"

config-version: 2
version: "0.1"
Expand All @@ -24,7 +24,7 @@ seeds:
node_color: "#cd7f32"

models:
test_dagster_metadata:
test_dagster_meta_config:
materialized: table
staging:
materialized: view
Expand Down

Large diffs are not rendered by default.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@
manifest_path = Path(__file__).joinpath("..", "sample_manifest.json").resolve()
manifest = json.loads(manifest_path.read_bytes())

test_dagster_metadata_manifest_path = (
test_dagster_meta_config_manifest_path = (
Path(__file__)
.joinpath("..", "dbt_projects", "test_dagster_metadata", "manifest.json")
.joinpath("..", "dbt_projects", "test_dagster_meta_config", "manifest.json")
.resolve()
)
test_dagster_metadata_manifest = json.loads(test_dagster_metadata_manifest_path.read_bytes())
test_dagster_meta_config_manifest = json.loads(test_dagster_meta_config_manifest_path.read_bytes())

test_dagster_asset_key_exceptions_path = (
Path(__file__)
Expand Down Expand Up @@ -424,7 +424,7 @@ def get_partition_mapping(
return partition_mapping

@dbt_assets(
manifest=test_dagster_metadata_manifest,
manifest=test_dagster_meta_config_manifest,
dagster_dbt_translator=CustomizedDagsterDbtTranslator(),
partitions_def=DailyPartitionsDefinition(start_date="2023-10-01"),
)
Expand Down Expand Up @@ -535,7 +535,7 @@ def my_dbt_assets():


def test_dbt_meta_auto_materialize_policy() -> None:
@dbt_assets(manifest=test_dagster_metadata_manifest)
@dbt_assets(manifest=test_dagster_meta_config_manifest)
def my_dbt_assets():
...

Expand All @@ -547,7 +547,7 @@ def my_dbt_assets():


def test_dbt_meta_freshness_policy() -> None:
@dbt_assets(manifest=test_dagster_metadata_manifest)
@dbt_assets(manifest=test_dagster_meta_config_manifest)
def my_dbt_assets():
...

Expand All @@ -561,7 +561,7 @@ def my_dbt_assets():


def test_dbt_meta_asset_key() -> None:
@dbt_assets(manifest=test_dagster_metadata_manifest)
@dbt_assets(manifest=test_dagster_meta_config_manifest)
def my_dbt_assets():
...

Expand All @@ -579,7 +579,7 @@ def my_dbt_assets():


def test_dbt_config_group() -> None:
@dbt_assets(manifest=test_dagster_metadata_manifest)
@dbt_assets(manifest=test_dagster_meta_config_manifest)
def my_dbt_assets():
...

Expand All @@ -599,7 +599,7 @@ def my_dbt_assets():


def test_dbt_with_downstream_asset_via_definition():
@dbt_assets(manifest=test_dagster_metadata_manifest)
@dbt_assets(manifest=test_dagster_meta_config_manifest)
def my_dbt_assets():
...

Expand All @@ -613,7 +613,7 @@ def downstream_of_dbt():


def test_dbt_with_downstream_asset():
@dbt_assets(manifest=test_dagster_metadata_manifest)
@dbt_assets(manifest=test_dagster_meta_config_manifest)
def my_dbt_assets():
...

Expand All @@ -629,7 +629,9 @@ def downstream_of_dbt():
def test_dbt_with_custom_resource_key() -> None:
dbt_resource_key = "my_custom_dbt_resource_key"

@dbt_assets(manifest=test_dagster_metadata_manifest, required_resource_keys={dbt_resource_key})
@dbt_assets(
manifest=test_dagster_meta_config_manifest, required_resource_keys={dbt_resource_key}
)
def my_dbt_assets(context: AssetExecutionContext):
dbt = getattr(context.resources, dbt_resource_key)

Expand All @@ -639,7 +641,9 @@ def my_dbt_assets(context: AssetExecutionContext):
[my_dbt_assets],
resources={
dbt_resource_key: DbtCliResource(
project_dir=os.fspath(test_dagster_metadata_manifest_path.joinpath("..").resolve())
project_dir=os.fspath(
test_dagster_meta_config_manifest_path.joinpath("..").resolve()
)
)
},
)
Expand Down Expand Up @@ -756,8 +760,8 @@ def get_asset_key(cls, dbt_resource_props: Mapping[str, Any]) -> AssetKey:
expected_error_message = "\n".join(
[
"The following dbt resources have the asset key `['duplicate']`:",
" - `model.test_dagster_metadata.customers` (models/customers.sql)",
" - `model.test_dagster_metadata.orders` (models/orders.sql)",
" - `model.test_dagster_meta_config.customers` (models/customers.sql)",
" - `model.test_dagster_meta_config.orders` (models/orders.sql)",
]
)

Expand All @@ -767,7 +771,7 @@ def get_asset_key(cls, dbt_resource_props: Mapping[str, Any]) -> AssetKey:
) as exc_info:

@dbt_assets(
manifest=test_dagster_metadata_manifest,
manifest=test_dagster_meta_config_manifest,
dagster_dbt_translator=CustomDagsterDbtTranslator(),
)
def my_dbt_assets():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

manifest_path = (
Path(__file__)
.joinpath("..", "dbt_projects", "test_dagster_metadata", "manifest.json")
.joinpath("..", "dbt_projects", "test_dagster_meta_config", "manifest.json")
.resolve()
)
manifest = json.loads(manifest_path.read_bytes())
Expand Down

0 comments on commit afceff5

Please sign in to comment.