Skip to content

Commit

Permalink
fix apply hints (#612)
Browse files Browse the repository at this point in the history
* fix apply hints

* move column fixing into helper function
  • Loading branch information
sh-rp authored Sep 11, 2023
1 parent e851156 commit 171bf15
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions dlt/extract/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ def ensure_table_schema_columns(columns: TAnySchemaColumns) -> TTableSchemaColum
"""
if isinstance(columns, C_Mapping):
# Assume dict is already in the correct format
# but ensure the name key is set correctly
for name, column in columns.items():
column["name"] = name
return columns
elif isinstance(columns, Sequence):
# Assume list of columns
Expand Down
2 changes: 2 additions & 0 deletions tests/extract/test_decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,8 @@ def get_users():
t = r.table_schema()

assert t["columns"]["tags"]["x-second-extra"] == "x-second-annotation"
# make sure column name was set
assert t["columns"]["tags"]["name"] == "tags"


def test_columns_from_pydantic() -> None:
Expand Down

0 comments on commit 171bf15

Please sign in to comment.