From b78e43e8d78aae4d8ac5559d6e5e0a686bcf96f3 Mon Sep 17 00:00:00 2001 From: Onkar Ravgan Date: Fri, 23 Feb 2024 16:01:47 +0530 Subject: [PATCH] fixed looker and optional proj filters (#15289) --- .../metadata/ingestion/source/dashboard/looker/metadata.py | 7 +++---- ingestion/src/metadata/utils/filters.py | 4 ++++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/ingestion/src/metadata/ingestion/source/dashboard/looker/metadata.py b/ingestion/src/metadata/ingestion/source/dashboard/looker/metadata.py index 404473b7208..bbb6ed987fa 100644 --- a/ingestion/src/metadata/ingestion/source/dashboard/looker/metadata.py +++ b/ingestion/src/metadata/ingestion/source/dashboard/looker/metadata.py @@ -661,7 +661,7 @@ class LookerSource(DashboardServiceSource): ], # Dashboards are created from the UI directly. They are not linked to a project # like LookML assets, but rather just organised in folders. - project=self._get_dashboard_project(dashboard_details), + project=self.get_project_name(dashboard_details), sourceUrl=f"{clean_uri(self.service_connection.hostPort)}/dashboards/{dashboard_details.id}", service=self.context.dashboard_service, owner=self.get_owner_ref(dashboard_details=dashboard_details), @@ -669,8 +669,7 @@ class LookerSource(DashboardServiceSource): yield Either(right=dashboard_request) self.register_record(dashboard_request=dashboard_request) - @staticmethod - def _get_dashboard_project(dashboard_details: LookerDashboard) -> Optional[str]: + def get_project_name(self, dashboard_details: LookerDashboard) -> Optional[str]: """ Get dashboard project if the folder is informed """ @@ -680,7 +679,7 @@ class LookerSource(DashboardServiceSource): logger.debug( f"Cannot get folder name from dashboard [{dashboard_details.title}] - [{exc}]" ) - return None + return None @staticmethod def _clean_table_name(table_name: str) -> str: diff --git a/ingestion/src/metadata/utils/filters.py b/ingestion/src/metadata/utils/filters.py index fa9fc268d95..00b9f32b4e8 100644 --- a/ingestion/src/metadata/utils/filters.py +++ b/ingestion/src/metadata/utils/filters.py @@ -54,6 +54,10 @@ def _filter(filter_pattern: Optional[FilterPattern], name: str) -> bool: # No filter pattern, nothing to filter return False + if filter_pattern and not name: + # Filter pattern is present but not the name so we'll filter it out + return True + if filter_pattern.includes: validate_regex(filter_pattern.includes) return not any( # pylint: disable=use-a-generator