Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ingestion/looker): filter Looker dashboards by folder #11205

Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,17 @@ 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="Filter for specific looker folder. "
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick: Say "Allow or deny dashboards from specific folders"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

"For example: \n"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment is super long. I'll let Harshal decide what to do here

Copy link
Collaborator

@hsheth2 hsheth2 Aug 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can probably just say "Dashboards will only be ingested if they're allowed by both this config and dashboard_pattern"

seems like it's missing a space in the middle, but doesn't look too long

image

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

"deny: \n"
" - sales/deprecated \n"
"This pattern will deny the ingestion of all dashboards and looks within the sales/deprecated folder."
"This pattern is applied after dashboard_pattern. Dashboards selected by `dashboard_pattern` may be denied "
"based on `folder_path_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