Skip to content

Commit 3e9d0ac

Browse files
committed
feat: add support for GEO_AREA label
GEO_AREA label was missing in gooddata-dbt and needs to be added. JIRA: TRIVIAL risk: low
1 parent 5a9eb34 commit 3e9d0ac

File tree

4 files changed

+24
-12
lines changed

4 files changed

+24
-12
lines changed

packages/gooddata-dbt/src/gooddata_dbt/dbt/base.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ class GoodDataLabelType(Enum):
2121
HYPERLINK = "HYPERLINK"
2222
GEO_LATITUDE = "GEO_LATITUDE"
2323
GEO_LONGITUDE = "GEO_LONGITUDE"
24+
GEO_AREA = "GEO_AREA"
2425

2526

2627
class GoodDataSortDirection(Enum):

packages/gooddata-dbt/src/gooddata_dbt/dbt/tables.py

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ class DbtModelMetaGoodDataColumnProps(Base):
4040
sort_column: str | None = None
4141
sort_direction: GoodDataSortDirection | None = None
4242
default_view: bool | None = None
43+
geo_area_config: dict[str, dict[str, str]] | None = None
4344

4445
@property
4546
def gooddata_ref_table_ldm_id(self) -> str | None:
@@ -392,17 +393,18 @@ def make_labels(table: DbtModelTable, attribute_column: DbtModelColumn) -> tuple
392393
default_view = None
393394
for column in table.columns.values():
394395
if column.gooddata_is_label(attribute_column.name):
395-
labels.append(
396-
{
397-
"id": column.ldm_id,
398-
"title": column.gooddata_ldm_title,
399-
"description": column.gooddata_ldm_description,
400-
"source_column": column.name,
401-
"source_column_data_type": column.data_type,
402-
"value_type": column.label_type,
403-
"tags": [table.gooddata_ldm_title] + column.tags,
404-
}
405-
)
396+
label_dict: dict = {
397+
"id": column.ldm_id,
398+
"title": column.gooddata_ldm_title,
399+
"description": column.gooddata_ldm_description,
400+
"source_column": column.name,
401+
"source_column_data_type": column.data_type,
402+
"value_type": column.label_type,
403+
"tags": [table.gooddata_ldm_title] + column.tags,
404+
}
405+
if column.meta.gooddata.geo_area_config is not None:
406+
label_dict["geo_area_config"] = column.meta.gooddata.geo_area_config
407+
labels.append(label_dict)
406408
if column.meta.gooddata.default_view:
407409
default_view = {
408410
"id": column.ldm_id,

packages/gooddata-dbt/tests/resources/dbt_target/manifest.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1868,7 +1868,12 @@
18681868
"gooddata": {
18691869
"ldm_type": "label",
18701870
"label_type": "GEO_AREA",
1871-
"attribute_column": "code"
1871+
"attribute_column": "code",
1872+
"geo_area_config": {
1873+
"collection": {
1874+
"id": "countries"
1875+
}
1876+
}
18721877
}
18731878
},
18741879
"data_type": null,

packages/gooddata-dbt/tests/test_tables.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,3 +77,7 @@ def test_make_ldm_geo_area():
7777
assert label_types["latitude_origin"] == "GEO_LATITUDE"
7878
assert label_types["longitude_origin"] == "GEO_LONGITUDE"
7979
assert label_types["country_origin"] == "GEO_AREA"
80+
# Verify geo_area_config is propagated
81+
country_label = next(lbl for lbl in labels if lbl.id == "country_origin")
82+
assert country_label.geo_area_config is not None
83+
assert country_label.geo_area_config.collection.id == "countries"

0 commit comments

Comments
 (0)