Skip to content

Commit

Permalink
🔊 Log which key was missing in target ID lookup
Browse files Browse the repository at this point in the history
  • Loading branch information
znatty22 committed Jun 12, 2024
1 parent bb18b8e commit 736c6f9
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions kf_lib_data_ingest/etl/load/load_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,8 +254,10 @@ def _load_entity(self, entity_class, record):
"""
try:
key_components = self._do_target_get_key(entity_class, record)
except Exception:
except Exception as e:
# no new key, no new entity
if isinstance(e, KeyError):
self.logger.warning(f"❌ Key {str(e)} not found")
key_components = None

if not key_components:
Expand Down Expand Up @@ -388,7 +390,8 @@ def _run(self, transform_output):
t_key = "default"

# convert df to list of dicts
transformed_records = transform_output[t_key].to_dict("records")
transformed_records = transform_output[t_key].to_dict(
"records")

if hasattr(entity_class, "transform_records_list"):
transformed_records = entity_class.transform_records_list(
Expand Down

0 comments on commit 736c6f9

Please sign in to comment.