Skip to content

Commit

Permalink
feat(dbt): sync column label
Browse files Browse the repository at this point in the history
  • Loading branch information
betodealmeida committed Mar 30, 2023
1 parent 8a3a8b3 commit a419429
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/preset_cli/cli/superset/sync/dbt/datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ def sync_datasets( # pylint: disable=too-many-locals, too-many-branches, too-ma
name = column["column_name"]
if name in columns:
column["description"] = columns[name].get("description", "")
column["label"] = columns[name].get("label", "")

# remove columns that are not part of the update payload
for key in ("changed_on", "created_on", "type_generic"):
Expand Down
7 changes: 6 additions & 1 deletion tests/cli/superset/sync/dbt/datasets_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"meta": {},
"name": "messages_channels",
"unique_id": "model.superset_examples.messages_channels",
"columns": {"id": {"description": "Primary key"}},
"columns": {"id": {"description": "Primary key", "label": "some label"}},
},
),
]
Expand Down Expand Up @@ -115,6 +115,7 @@ def test_sync_datasets_new(mocker: MockerFixture) -> None:
{
"column_name": "id",
"description": "Primary key",
"label": "some label",
"is_dttm": False,
},
{
Expand Down Expand Up @@ -205,6 +206,7 @@ def test_sync_datasets_with_alias(mocker: MockerFixture) -> None:
{
"column_name": "id",
"description": "Primary key",
"label": "some label",
"is_dttm": False,
},
{
Expand Down Expand Up @@ -264,6 +266,7 @@ def test_sync_datasets_no_metrics(mocker: MockerFixture) -> None:
{
"column_name": "id",
"description": "Primary key",
"label": "some label",
"is_dttm": False,
},
],
Expand Down Expand Up @@ -356,6 +359,7 @@ def test_sync_datasets_existing(mocker: MockerFixture) -> None:
{
"column_name": "id",
"description": "Primary key",
"label": "some label",
"is_dttm": False,
},
],
Expand Down Expand Up @@ -443,6 +447,7 @@ def test_sync_datasets_external_url(mocker: MockerFixture) -> None:
{
"column_name": "id",
"description": "Primary key",
"label": "some label",
"is_dttm": False,
},
],
Expand Down

0 comments on commit a419429

Please sign in to comment.