A Python automation fetches rows from BigQuery and updates a Google Sheet. The job is re-run with overlapping date ranges. Which technique best ensures that repeated runs do not create duplicate sheet entries?

Answer

Use a deterministic row identifier (e.g., hash of primary keys) and upsert by that identifier

Explanation

Deterministic identifiers allow upserts to replace existing entries rather than duplicating them. This remains correct even with overlapping windows and retries.

Last reviewed: October 2026

Reviewed by FirstInTest Editorial Team

Report an error
QuestionBack to list