Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,11 @@ def get_org_workspace_data(self) -> Iterable[Group | None]:
self.dashboard_listing,
)
)
# Tiles and tables are read only for the dashboards and data models the
# filters keep; the workspace still lists every one, for the listing counters.
for dashboard in workspace.dashboards:
# add the tiles to the dashboards
if not self._kept_dashboard(dashboard):
continue
dashboard.tiles.extend(
self.client.api_client.fetch_all_org_tiles(group_id=workspace.id, dashboard_id=dashboard.id)
or []
Expand All @@ -236,7 +239,8 @@ def get_org_workspace_data(self) -> Iterable[Group | None]:
)
)
for dataset in workspace.datasets:
# add the tables to the datasets
if not self._kept_datamodel(dataset):
continue
dataset.tables.extend(
self.client.api_client.fetch_dataset_tables(group_id=workspace.id, dataset_id=dataset.id)
or []
Expand All @@ -245,6 +249,15 @@ def get_org_workspace_data(self) -> Iterable[Group | None]:
else:
logger.error("Unable to fetch any PowerBI workspaces")

def _kept_dashboard(self, dashboard: PowerBIDashboard) -> bool:
"""Whether `get_dashboard` will process the dashboard. Decides only; it does not report."""
name = self.get_dashboard_name(dashboard)
return bool(name) and not filter_by_dashboard(self.source_config.dashboardFilterPattern, name)

def _kept_datamodel(self, dataset: Dataset) -> bool:
"""Whether `_filtered_datamodels` will keep the dataset. Decides only; it does not report."""
return bool(dataset.name) and not filter_by_datamodel(self.source_config.dataModelFilterPattern, dataset.name)

def _paginate_project_filter_pattern(self, filter_pattern):
"""
paginate include filters if more then `10` filters
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,7 @@ def get_tables_name_and_type(self) -> Iterable[tuple[str, TableType]] | None:
database_name=self.context.get().database,
schema_name=self.context.get().database_schema,
table_name=view_name,
skip_es_search=True,
)

if filter_by_table(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,10 @@ def get_schema_name_list(self) -> list[str]:
need to be overridden by sources
"""

def get_raw_database_schema_names(self) -> Iterable[str]:
"""List schemas without filtering or reporting; mark-deleted filters them itself."""
yield from self.get_schema_name_list()

def get_database_schema_names(self) -> Iterable[str]:
for schema in self.get_schema_name_list():
schema_fqn = fqn.build(
Expand Down Expand Up @@ -251,6 +255,7 @@ def get_tables_name_and_type(self) -> Iterable[tuple[str, TableType]] | None:
database_name=self.context.get().database,
schema_name=self.context.get().database_schema,
table_name=table_name,
skip_es_search=True,
)
if filter_by_table(
self.source_config.tableFilterPattern,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -849,14 +849,12 @@ def mark_databases_as_deleted(self):
f"Mark Deleted Databases set to True. Processing service [{self.context.get().database_service}]"
)

# We need to include ALL databases from the source in the source state
# This includes both processed databases and all databases (filtered-in and filtered-out)
# to ensure we mark as deleted any databases that were previously ingested but are now
# filtered out, as well as any databases that were processed in this run
# Keep every database the filter lets in, processed or not; a database that is now
# filtered out is left out, so one ingested earlier is marked as deleted. Ingestion
# already reported the excluded ones, so this listing does not report them again.
all_database_fqns = set()

# Get all databases from the source (both filtered-in and filtered-out)
for database_name in self._get_filtered_database_names():
for database_name in self._get_filtered_database_names(add_to_status=False):
database_fqn = fqn.build(
self.metadata,
entity_type=Database,
Expand Down
46 changes: 23 additions & 23 deletions ingestion/src/metadata/utils/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def filter_by_schema(schema_filter_pattern: FilterPattern | None, schema_name: s
"""
Return True if the schema needs to be filtered, False otherwise

Include takes precedence over exclude
Exclude takes precedence over include

:param schema_filter_pattern: Model defining schema filtering logic
:param schema fqn: table schema fqn
Expand All @@ -115,7 +115,7 @@ def filter_by_table(table_filter_pattern: FilterPattern | None, table_name: str)
"""
Return True if the table needs to be filtered, False otherwise

Include takes precedence over exclude
Exclude takes precedence over include

:param table_filter_pattern: Model defining schema filtering logic
:param table_fqn: table fqn
Expand All @@ -139,7 +139,7 @@ def filter_by_chart(chart_filter_pattern: FilterPattern | None, chart_name: str)
"""
Return True if the chart needs to be filtered, False otherwise

Include takes precedence over exclude
Exclude takes precedence over include

:param chart_filter_pattern: Model defining chart filtering logic
:param chart_name: chart name
Expand All @@ -152,7 +152,7 @@ def filter_by_topic(topic_filter_pattern: FilterPattern | None, topic_name: str)
"""
Return True if the topic needs to be filtered, False otherwise

Include takes precedence over exclude
Exclude takes precedence over include

:param topic_filter_pattern: Model defining chart filtering logic
:param topic_name: topic name
Expand All @@ -165,7 +165,7 @@ def filter_by_dashboard(dashboard_filter_pattern: FilterPattern | None, dashboar
"""
Return True if the dashboard needs to be filtered, False otherwise

Include takes precedence over exclude
Exclude takes precedence over include

:param dashboard_filter_pattern: Model defining dashboard filtering logic
:param dashboard_name: dashboard name
Expand All @@ -181,7 +181,7 @@ def filter_by_stored_procedure(
"""
Return True if the stored procedure needs to be filtered, False otherwise

Include takes precedence over exclude
Exclude takes precedence over include

:param stored_procedure_filter_pattern: Model defining stored procedure filtering logic
:param stored_procedure_name: stored procedure name
Expand All @@ -194,7 +194,7 @@ def filter_by_fqn(fqn_filter_pattern: FilterPattern | None, fqn: str) -> bool:
"""
Return True if the FQN needs to be filtered, False otherwise

Include takes precedence over exclude
Exclude takes precedence over include

:param fqn_filter_pattern: Model defining FQN filtering logic
:param fqn: table FQN name
Expand All @@ -207,7 +207,7 @@ def filter_by_database(database_filter_pattern: FilterPattern | None, database_n
"""
Return True if the schema needs to be filtered, False otherwise

Include takes precedence over exclude
Exclude takes precedence over include

:param database_filter_pattern: Model defining database filtering logic
:param database_name: database name
Expand All @@ -220,7 +220,7 @@ def filter_by_pipeline(pipeline_filter_pattern: FilterPattern | None, pipeline_n
"""
Return True if the schema needs to be filtered, False otherwise

Include takes precedence over exclude
Exclude takes precedence over include

:param pipeline_filter_pattern: Model defining the pipeline filtering logic
:param pipeline_name: pipeline name
Expand All @@ -233,7 +233,7 @@ def filter_by_mlmodel(mlmodel_filter_pattern: FilterPattern | None, mlmodel_name
"""
Return True if the mlmodel needs to be filtered, False otherwise

Include takes precedence over exclude
Exclude takes precedence over include

:param mlmodel_filter_pattern: Model defining the mlmodel filtering logic
:param mlmodel_name: mlmodel name
Expand All @@ -246,7 +246,7 @@ def filter_by_container(container_filter_pattern: FilterPattern | None, containe
"""
Return True if the container needs to be filtered, False otherwise

Include takes precedence over exclude
Exclude takes precedence over include

:param container_filter_pattern: Container defining the container filtering logic
:param container_name: container name
Expand All @@ -259,7 +259,7 @@ def filter_by_datamodel(datamodel_filter_pattern: FilterPattern | None, datamode
"""
Return True if the models needs to be filtered, False otherwise

Include takes precedence over exclude
Exclude takes precedence over include

:param datamodel_filter_pattern: Model defining data model filtering logic
:param datamodel_name: data model name
Expand All @@ -272,7 +272,7 @@ def filter_by_project(project_filter_pattern: FilterPattern | None, project_name
"""
Return True if the project needs to be filtered, False otherwise

Include takes precedence over exclude
Exclude takes precedence over include

:param project_filter_pattern: Model defining project filtering logic
:param project_name: project name
Expand All @@ -285,7 +285,7 @@ def filter_by_search_index(search_index_filter_pattern: FilterPattern | None, se
"""
Return True if the models needs to be filtered, False otherwise

Include takes precedence over exclude
Exclude takes precedence over include

:param search_index_filter_pattern: Model defining search index filtering logic
:param search_index_name: search index name
Expand All @@ -298,7 +298,7 @@ def filter_by_classification(classification_pattern: FilterPattern | None, class
"""
Return True if the models needs to be filtered, False otherwise

Include takes precedence over exclude
Exclude takes precedence over include

:param search_index_filter_pattern: Model defining search index filtering logic
:param search_index_name: search index name
Expand Down Expand Up @@ -346,7 +346,7 @@ def filter_by_collection(collection_pattern: FilterPattern | None, collection_na
"""
Return True if the models needs to be filtered, False otherwise

Include takes precedence over exclude
Exclude takes precedence over include

:param collection_pattern: Model defining collection filtering logic
:param collection_name: collection name
Expand All @@ -359,7 +359,7 @@ def filter_by_endpoint(endpoint_pattern: FilterPattern | None, endpoint_name: st
"""
Return True if the endpoint needs to be filtered, False otherwise

Include takes precedence over exclude
Exclude takes precedence over include

:param endpoint_pattern: Model defining endpoint filtering logic
:param endpoint_name: endpoint name
Expand All @@ -372,7 +372,7 @@ def filter_by_tag(tag_pattern: FilterPattern | None, tag_name: str) -> bool:
"""
Return True if the models needs to be filtered, False otherwise

Include takes precedence over exclude
Exclude takes precedence over include

:param tag_pattern: Model defining tag filtering logic
:param tag_name: tag name
Expand All @@ -385,7 +385,7 @@ def filter_by_spreadsheet(spreadsheet_filter_pattern: FilterPattern | None, spre
"""
Return True if the spreadsheet needs to be filtered, False otherwise

Include takes precedence over exclude
Exclude takes precedence over include

:param spreadsheet_filter_pattern: Model defining spreadsheet filtering logic
:param spreadsheet_name: spreadsheet name
Expand All @@ -398,7 +398,7 @@ def filter_by_directory(directory_filter_pattern: FilterPattern | None, director
"""
Return True if the directory needs to be filtered, False otherwise

Include takes precedence over exclude
Exclude takes precedence over include

:param directory_filter_pattern: Model defining directory filtering logic
:param directory_name: directory name
Expand All @@ -411,7 +411,7 @@ def filter_by_file(file_filter_pattern: FilterPattern | None, file_name: str) ->
"""
Return True if the file needs to be filtered, False otherwise

Include takes precedence over exclude
Exclude takes precedence over include

:param file_filter_pattern: Model defining file filtering logic
:param file_name: file name
Expand All @@ -424,7 +424,7 @@ def filter_by_worksheet(worksheet_filter_pattern: FilterPattern | None, workshee
"""
Return True if the worksheet needs to be filtered, False otherwise

Include takes precedence over exclude
Exclude takes precedence over include

:param worksheet_filter_pattern: Model defining worksheet filtering logic
:param worksheet_name: worksheet name
Expand All @@ -437,7 +437,7 @@ def filter_by_server(server_filter_pattern: FilterPattern | None, server_name: s
"""
Return True if the MCP server needs to be filtered, False otherwise

Include takes precedence over exclude
Exclude takes precedence over include

:param server_filter_pattern: Model defining server filtering logic
:param server_name: server name
Expand Down
Loading
Loading