Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Empty rows fix #745

Merged
merged 1 commit into from
Nov 9, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion tests/pipeline/test_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -1201,4 +1201,21 @@ def nested_resource():
# print(pipeline.default_schema.to_pretty_yaml())
assert pipeline.default_schema.get_table("flattened_dict__values")["columns"]["value__timestamp_value"]["data_type"] == "timestamp"
# make sure data is there
assert pipeline.last_trace.last_normalize_info.row_counts["flattened_dict__values"] == 4
assert pipeline.last_trace.last_normalize_info.row_counts["flattened_dict__values"] == 4


def test_empty_rows_are_included() -> None:
"""Empty rows where all values are `None` or empty dicts
create rows in the dataset with `NULL` in all columns
"""
pipeline = dlt.pipeline(destination='duckdb')

pipeline.run(iter([{}, {}, {}]), table_name="empty_rows")
pipeline.run(iter([{"a": 1}, {}, {}]), table_name="empty_rows")
pipeline.run(iter([{"a": None}, {}]), table_name="empty_rows")

with pipeline.sql_client() as client:
rows = client.execute_sql("SELECT a FROM empty_rows ORDER BY a")

values = [r[0] for r in rows]
assert values == [1, None, None, None, None, None, None, None]
Loading