MINOR: Fix data insights misbehaving due to validation error (#16251)

* Add a Try/Except block to allow the ingestion to continue if ValidationError occurs

* Fix checkstyle

* Fix linter
This commit is contained in:
IceS2 2024-05-14 14:37:56 +02:00 committed by GitHub
parent bb6c0b1096
commit d91ec3d6a0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -19,6 +19,8 @@ import re
from collections import namedtuple
from typing import Generator, Iterable, Optional
from pydantic import ValidationError
from metadata.data_insight.processor.reports.data_processor import DataProcessor
from metadata.generated.schema.analytics.reportData import ReportData, ReportDataType
from metadata.generated.schema.analytics.reportDataType.webAnalyticEntityViewReportData import (
@ -123,11 +125,16 @@ class WebAnalyticEntityViewReportDataProcessor(DataProcessor):
logger.debug(f"Could not find entity Href for {entity_obj.fqn}")
if entity_obj.fqn not in refined_data:
entity = self.metadata.get_by_name(
ENTITIES[entity_obj.entity_type],
fqn=entity_obj.fqn,
fields=["*"],
)
try:
entity = self.metadata.get_by_name(
ENTITIES[entity_obj.entity_type],
fqn=entity_obj.fqn,
fields=["*"],
)
except ValidationError as exc:
entity = None
logger.warning("%s Entity failed to be parsed", entity_obj.fqn)
logger.debug(exc)
if not entity:
# If a user visits an entity and then deletes this entity, we will try to get the entity