Skip to content

Commit

Permalink
test: add test with hint for parent table
Browse files Browse the repository at this point in the history
  • Loading branch information
joscha committed Nov 28, 2024
1 parent 9a49868 commit 88d8192
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tests/pipeline/test_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -661,6 +661,28 @@ def with_table_hints():
# check table counts
assert_data_table_counts(pipeline, {"table_a": 2, "table_b": 2, "table_c": 1})

def test_mark_parent_table() -> None:
@dlt.resource()
def my_table():
yield {"id": 1}
yield dlt.mark.with_hints(
{"id": 10},
dlt.mark.make_hints(
table_name="my_other_table",
parent_table_name="my_table"
),
)
pipeline_name = "pipe_" + uniq_id()
pipeline = dlt.pipeline(pipeline_name=pipeline_name, destination="duckdb")
info = pipeline.run(my_table)
assert_load_info(info)
assert pipeline.last_trace.last_normalize_info.row_counts == {
"_dlt_pipeline_state": 1,
"my_table": 1,
"other_table": 1,
}
# check table counts
assert_data_table_counts(pipeline, {"my_table": 1, "other_table": 1 })

def test_restore_state_on_dummy() -> None:
pipeline_name = "pipe_" + uniq_id()
Expand Down

0 comments on commit 88d8192

Please sign in to comment.