fixed looker and optional proj filters (#15289)

This commit is contained in:
Onkar Ravgan 2024-02-23 16:01:47 +05:30 committed by GitHub
parent 7f111c7ed8
commit b78e43e8d7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 4 deletions

View File

@ -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:

View File

@ -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