Skip to content

Commit

Permalink
adds nested tables dlt columns collision test
Browse files Browse the repository at this point in the history
  • Loading branch information
rudolfix committed Aug 28, 2024
1 parent a795d27 commit 73e5763
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
2 changes: 0 additions & 2 deletions tests/common/cases/normalizers/sql_upper.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from typing import Any, Sequence

from dlt.common.normalizers.naming.naming import NamingConvention as BaseNamingConvention


Expand Down
14 changes: 14 additions & 0 deletions tests/pipeline/test_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -2600,6 +2600,20 @@ def ids(_id=dlt.sources.incremental("_id", initial_value=2)):
assert pipeline.last_trace.last_normalize_info.row_counts["_ids"] == 2


def test_dlt_columns_nested_table_collisions() -> None:
# we generate all identifiers in upper case to test for a bug where dlt columns for nested tables were hardcoded to
# small caps. they got normalized to upper case after the first run and then added again as small caps
# generating duplicate columns and raising collision exception as duckdb is ci destination
duck = duckdb(naming_convention="tests.common.cases.normalizers.sql_upper")
pipeline = dlt.pipeline("test_dlt_columns_child_table_collisions", destination=duck)
customers = [
{"id": 1, "name": "dave", "orders": [1, 2, 3]},
]
assert_load_info(pipeline.run(customers, table_name="CUSTOMERS"))
# this one would fail without bugfix
assert_load_info(pipeline.run(customers, table_name="CUSTOMERS"))


def test_access_pipeline_in_resource() -> None:
pipeline = dlt.pipeline("test_access_pipeline_in_resource", destination="duckdb")

Expand Down

0 comments on commit 73e5763

Please sign in to comment.