Context
Identified during review of #558 (558-radionuclides-backfill branch).
Problem
In chemistry_backfill.py, after the pg_insert upsert, the code looks up the just-upserted Observation using scalar_one() (line ~259). This can raise NoResultFound or MultipleResultsFound with no context about which GlobalID was being processed.
Fix
Replace scalar_one() with scalar_one_or_none() and add explicit error handling that includes the GlobalID in the error message. Append to result.errors and continue rather than crashing the entire backfill.
Files
transfers/backfill/chemistry_backfill.py (lines 255–259)
Context
Identified during review of #558 (
558-radionuclides-backfillbranch).Problem
In
chemistry_backfill.py, after thepg_insertupsert, the code looks up the just-upserted Observation usingscalar_one()(line ~259). This can raiseNoResultFoundorMultipleResultsFoundwith no context about which GlobalID was being processed.Fix
Replace
scalar_one()withscalar_one_or_none()and add explicit error handling that includes the GlobalID in the error message. Append toresult.errorsandcontinuerather than crashing the entire backfill.Files
transfers/backfill/chemistry_backfill.py(lines 255–259)