Skip to content

Commit 41b3dd3

Browse files
committed
refactor(looker): streamline handling of dimension group fields in view upstream processing
- Updated logic to ensure only one field per dimension group is added, improving clarity and maintainability of the code. - Removed redundant checks and added comments for better understanding of the dimension group handling process.
1 parent c104346 commit 41b3dd3

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

metadata-ingestion/src/datahub/ingestion/source/looker/view_upstream.py

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -622,17 +622,15 @@ def _get_fields_from_looker_api(self, explore_name: str) -> List[str]:
622622
if dim_field.name and self._is_field_from_current_view(
623623
dim_field, current_view_name
624624
):
625-
# Skipping adding dimension group fields if already added
626-
if (
627-
dim_field.dimension_group
628-
and dim_field.dimension_group
629-
in dimension_group_fields_mapping
630-
):
631-
continue
632-
else:
633-
assert (
634-
dim_field.dimension_group is not None
635-
) # HAPPY linter
625+
# Handle dimension group fields - only add one field per dimension group
626+
if dim_field.dimension_group:
627+
# Skip if this dimension group already has a field
628+
if (
629+
dim_field.dimension_group
630+
in dimension_group_fields_mapping
631+
):
632+
continue
633+
# Add this field as the representative for this dimension group
636634
dimension_group_fields_mapping[
637635
dim_field.dimension_group
638636
] = dim_field.name

0 commit comments

Comments
 (0)