Skip to content

Commit 37a44a2

Browse files
fix: fix issue where reporting_entity resulted in key fields being removed from error reports
1 parent e745050 commit 37a44a2

File tree

4 files changed

+11
-1
lines changed

4 files changed

+11
-1
lines changed

src/dve/core_engine/backends/implementations/duckdb/rules.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -517,6 +517,7 @@ def notify(self, entities: DuckDBEntities, *, config: Notification) -> Messages:
517517
messages.append(
518518
FeedbackMessage(
519519
entity=config.reporting.reporting_entity_override or config.entity_name,
520+
original_entity=config.entity_name,
520521
record=record, # type: ignore
521522
error_location=config.reporting.legacy_location,
522523
error_message=template_object(config.reporting.message, record), # type: ignore

src/dve/core_engine/backends/implementations/spark/rules.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -412,6 +412,7 @@ def notify(self, entities: SparkEntities, *, config: Notification) -> Messages:
412412
# more complex extraction done in reporting module
413413
FeedbackMessage(
414414
entity=config.reporting.reporting_entity_override or config.entity_name,
415+
original_entity=config.entity_name,
415416
record=record.asDict(recursive=True),
416417
error_location=config.reporting.legacy_location,
417418
error_message=template_object(

src/dve/core_engine/message.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,8 @@ class FeedbackMessage: # pylint: disable=too-many-instance-attributes
105105
still be completed (i.e. filters and joins can still be applied).
106106
107107
"""
108+
original_entity: Optional[EntityName] = None
109+
"""The original entity before any modifications to the name (if applicable)."""
108110
is_informational: bool = False
109111
"""Whether the message is simply for information or has affected the outputs."""
110112
error_type: Optional[str] = None

src/dve/reporting/utils.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,13 @@ def dump_feedback_errors(
2626
processed = []
2727

2828
for message in messages:
29-
primary_keys: list[str] = key_fields.get(message.entity if message.entity else "", [])
29+
if message.original_entity is not None:
30+
primary_keys = key_fields.get(message.original_entity, [])
31+
elif message.entity is not None:
32+
primary_keys = key_fields.get(message.entity, [])
33+
else:
34+
primary_keys = []
35+
3036
error = message.to_dict(
3137
key_field=primary_keys,
3238
value_separator=" -- ",

0 commit comments

Comments
 (0)