Skip to content

Commit

Permalink
feat(ingestion/looker): filter Looker dashboards by folder (#11205)
Browse files Browse the repository at this point in the history
Co-authored-by: Harshal Sheth <hsheth2@gmail.com>
  • Loading branch information
sid-acryl and hsheth2 authored Aug 22, 2024
1 parent 88b3893 commit dc30c0a
Show file tree
Hide file tree
Showing 4 changed files with 1,054 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,16 @@ class LookerDashboardSourceConfig(
description="When enabled, platform instance will be added in dashboard and chart urn.",
)

folder_path_pattern: AllowDenyPattern = Field(
default=AllowDenyPattern.allow_all(),
description="Allow or deny dashboards from specific folders. "
"For example: \n"
"deny: \n"
" - sales/deprecated \n"
"This pattern will deny the ingestion of all dashboards and looks within the sales/deprecated folder. \n"
"Dashboards will only be ingested if they're allowed by both this config and dashboard_pattern.",
)

@validator("external_base_url", pre=True, always=True)
def external_url_defaults_to_api_config_base_url(
cls, v: Optional[str], *, values: Dict[str, Any], **kwargs: Dict[str, Any]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1334,6 +1334,17 @@ def process_dashboard(
looker_dashboard = self._get_looker_dashboard(dashboard_object)

workunits = []
if (
looker_dashboard.folder_path is not None
and not self.source_config.folder_path_pattern.allowed(
looker_dashboard.folder_path
)
):
logger.debug(
f"Folder path {looker_dashboard.folder_path} is denied in folder_path_pattern"
)
return [], None, dashboard_id, start_time, datetime.datetime.now()

if looker_dashboard.folder:
workunits += list(
self._get_folder_and_ancestors_workunits(looker_dashboard.folder)
Expand Down
Loading

0 comments on commit dc30c0a

Please sign in to comment.