-
Notifications
You must be signed in to change notification settings - Fork 2k
ISSUE #3028 - Eliminate Double Iteration on Entity Filtering and Push Regex Filters to API #26709
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
Changes from all commits
af663c3
d8dd66a
cec54d5
4035938
6a6d926
276fd83
8fb250a
5f5f2ac
90ab2c1
d32e95a
c2b1325
7757eb4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -14,7 +14,9 @@ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import traceback | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| from abc import ABC, abstractmethod | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| from typing import Iterable, Iterator, Optional, cast | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| from typing import Dict, Iterable, Iterator, List, Optional, cast | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| from pydantic import BaseModel | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| from metadata.generated.schema.entity.data.database import Database | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| from metadata.generated.schema.entity.data.table import TableType | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -25,6 +27,7 @@ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| OpenMetadataWorkflowConfig, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| from metadata.generated.schema.settings.settings import Settings | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| from metadata.generated.schema.type.filterPattern import FilterPattern | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| from metadata.ingestion.api.models import Either | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| from metadata.ingestion.api.status import Status | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| from metadata.ingestion.models.entity_interface import EntityInterfaceWithTags | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -37,14 +40,48 @@ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| from metadata.utils.db_utils import Table | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| from metadata.utils.filters import ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| filter_by_classification, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| filter_by_database, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| filter_by_schema, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| filter_by_table, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| validate_regex, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| FIELDS = ["tableProfilerConfig", "columns", "customMetrics", "tags"] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| class RegexFilter(BaseModel): | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| regex: str | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| mode: str | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| def _combine_patterns(patterns: List[str]) -> str: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if len(patterns) == 1: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return patterns[0] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return "|".join(f"({p})" for p in patterns) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| def _build_regex_from_filter( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| filter_pattern: Optional[FilterPattern], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) -> Optional[RegexFilter]: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| """Build a RegexFilter from a FilterPattern for server-side filtering. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| When both includes and excludes are set, includes take precedence. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Validates that all regex patterns compile before sending them to the server. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| """ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if not filter_pattern: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return None | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| validate_regex(filter_pattern.includes) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| validate_regex(filter_pattern.excludes) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if filter_pattern.includes: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return RegexFilter( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| regex=_combine_patterns(filter_pattern.includes), mode="include" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if filter_pattern.excludes: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return RegexFilter( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| regex=_combine_patterns(filter_pattern.excludes), mode="exclude" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return None | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+72
to
+82
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| class FetcherStrategy(ABC): | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| """Fetcher strategy interface""" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -114,84 +151,28 @@ def __init__( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| status: Status, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) -> None: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| super().__init__(config, metadata, global_profiler_config, status) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| self.database_filter_pattern = _build_regex_from_filter( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| self.source_config.databaseFilterPattern | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| self.schema_filter_pattern = _build_regex_from_filter( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| self.source_config.schemaFilterPattern | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| self.table_filter_pattern = _build_regex_from_filter( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| self.source_config.tableFilterPattern | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| self.source_config = cast( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| EntityFilterConfigInterface, self.source_config | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) # Satisfy typechecker | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| def _filter_databases(self, databases: Iterable[Database]) -> Iterable[Database]: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| """Filter databases based on the filter pattern | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Args: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| databases (Database): Database to filter | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Returns: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| bool | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| """ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| filtered_databases = [] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| for database in databases: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| database_name = database.name.root | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if database.fullyQualifiedName and self.source_config.useFqnForFiltering: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| database_name = database.fullyQualifiedName.root | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if filter_by_database( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| self.source_config.databaseFilterPattern, database_name | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ): | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| self.status.filter( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| database_name, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| f"Database pattern not allowed for database {database_name}", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| continue | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| filtered_databases.append(database) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return filtered_databases | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| def _filter_schemas(self, table: Table) -> bool: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| """Filter tables based on the schema filter pattern | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Args: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| tables (List[Table]): Tables to filter | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Returns: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| List[Table] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| """ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if not table.databaseSchema: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return False | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| schema_name = ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| table.databaseSchema.fullyQualifiedName | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if self.source_config.useFqnForFiltering | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| else table.databaseSchema.name | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if schema_name and filter_by_schema( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| self.source_config.schemaFilterPattern, schema_name | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ): | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| self.status.filter( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| schema_name, f"Schema pattern not allowed for schema {schema_name}" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return True | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return False | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| def _filter_tables(self, table: Table) -> bool: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| """Filter tables based on the table filter pattern | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Args: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| tables (Iterable[Table]): | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Returns: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Iterable[Table]: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| """ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| table_name = table.name.root | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if table.fullyQualifiedName and self.source_config.useFqnForFiltering: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| table_name = table.fullyQualifiedName.root | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if filter_by_table(self.source_config.tableFilterPattern, table_name): | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| self.status.filter( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| table_name, f"Table pattern not allowed for table {table_name}" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return True | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return False | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| def _build_database_params(self) -> Dict[str, str]: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| params: Dict[str, str] = {"service": self.config.source.serviceName} # type: ignore | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| db_filter = self.database_filter_pattern | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if db_filter: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| params["databaseRegex"] = db_filter.regex | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| params["regexMode"] = db_filter.mode | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if self.source_config.useFqnForFiltering: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| params["regexFilterByFqn"] = "true" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return params | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| def _filter_views(self, table: Table) -> bool: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| """Filter the tables based on include views configuration""" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -208,86 +189,129 @@ def _filter_views(self, table: Table) -> bool: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return False | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| def _filter_column_metrics_computation(self): | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| """Filter""" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| def _get_database_entities(self) -> Iterable[Database]: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| """Get database entities""" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if not self.config.source.serviceName: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| raise ValueError("serviceName must be provided in the source configuration") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| params = self._build_database_params() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| databases = self.metadata.list_all_entities( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| entity=Database, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| params={"service": self.config.source.serviceName}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| params=params, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if not databases: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| raise ValueError( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| f"No databases found for service {self.config.source.serviceName}" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| databases = cast(Iterable[Database], databases) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if self.source_config.databaseFilterPattern: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| databases = self._filter_databases(databases) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| count = 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| for database in databases: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| count += 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| yield database | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if not databases: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if count == 0: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| raise ValueError( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "databaseFilterPattern returned 0 result. At least 1 database must be returned by the filter pattern." | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| f"\n\t- includes: {self.source_config.databaseFilterPattern.includes if self.source_config.databaseFilterPattern else None}" # pylint: disable=line-too-long | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| f"\n\t- excludes: {self.source_config.databaseFilterPattern.excludes if self.source_config.databaseFilterPattern else None}" # pylint: disable=line-too-long | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
209
to
212
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| raise ValueError( | |
| "databaseFilterPattern returned 0 result. At least 1 database must be returned by the filter pattern." | |
| f"\n\t- includes: {self.source_config.databaseFilterPattern.includes if self.source_config.databaseFilterPattern else None}" # pylint: disable=line-too-long | |
| f"\n\t- excludes: {self.source_config.databaseFilterPattern.excludes if self.source_config.databaseFilterPattern else None}" # pylint: disable=line-too-long | |
| db_filter_pattern = self.source_config.databaseFilterPattern | |
| if db_filter_pattern: | |
| raise ValueError( | |
| "databaseFilterPattern returned 0 result. At least 1 database must be returned by the filter pattern." | |
| f"\n\t- includes: {db_filter_pattern.includes}" # pylint: disable=line-too-long | |
| f"\n\t- excludes: {db_filter_pattern.excludes}" # pylint: disable=line-too-long | |
| ) | |
| raise ValueError( | |
| "No databases were returned for the configured service. " | |
| "Either the service has no databases, or the service configuration is incorrect." |
Copilot
AI
Mar 24, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When no databases are returned, this now always raises the "databaseFilterPattern returned 0 result" error, even if no databaseFilterPattern was configured (e.g., the service is empty). That message becomes misleading and also suggests a filter pattern problem when the real issue is simply no databases for the service. Consider restoring the prior behavior: if a database filter pattern is configured and yields 0 results, raise this message; otherwise raise an error indicating no databases were found for the service.
| raise ValueError( | |
| "databaseFilterPattern returned 0 result. At least 1 database must be returned by the filter pattern." | |
| f"\n\t- includes: {self.source_config.databaseFilterPattern.includes if self.source_config.databaseFilterPattern else None}" # pylint: disable=line-too-long | |
| f"\n\t- excludes: {self.source_config.databaseFilterPattern.excludes if self.source_config.databaseFilterPattern else None}" # pylint: disable=line-too-long | |
| db_filter_pattern = self.source_config.databaseFilterPattern | |
| if db_filter_pattern: | |
| raise ValueError( | |
| "databaseFilterPattern returned 0 result. At least 1 database must be returned by the filter pattern." | |
| f"\n\t- includes: {db_filter_pattern.includes}" | |
| f"\n\t- excludes: {db_filter_pattern.excludes}" | |
| ) | |
| raise ValueError( | |
| f"No databases were found for the service {self.config.source.serviceName}. " | |
| "At least 1 database must be available for the profiler to run." |
Uh oh!
There was an error while loading. Please reload this page.