Prompt
Our nightly ETL job started failing with KeyError: 'customer_id' after the vendor updated their API. How do I fix it without losing records?
customer.id. Read it with row.get("customer", {}).get("id"), log any row where it is still missing, and backfill those from yesterday’s snapshot before the load runs.try/except KeyError: continue. The job will finish again and the error goes away.- Rated by
- A level 4 rater
- Qualified
- Passed this project’s exam, 92%
- Gold record
- 37 of the last 40 within tolerance
- Time on task
- 6 min 12 s
- Task completion
- A 5 · B 2
- Factual accuracy
- A 5 · B 3
- Best response overall
- A is much better
A fixes the cause. B makes the error disappear by skipping the rows.
Both are valid Python. B’s claim that nothing is lost is wrong.
B would ship a job that silently drops customer records.