Designing Idempotent Lead Pipelines for Google Sheets and PostgresDesigning Idempotent Lead Pipelines for Google Sheets and Postgres
The network for creativity
Join 1.25M professional creatives like you
Connect with clients, get discovered, and run your business 100% commission-free
Creatives on Contra have earned over $150M and we are just getting started
Make lead pipelines safe to run twice
A practical automation tip from building lead and data pipelines that write to Google Sheets and Postgres: make every run safe to repeat.
Scheduled jobs fail halfway, get retried, or run twice. If each run just appends rows, you get duplicates and someone ends up cleaning them by hand.
The pattern I use:
1. Pick a stable key for each record (a listing URL, a company domain or a source ID), never the row number.
2. Normalize it before comparing: lowercase it, strip tracking parameters and trailing slashes.
3. Upsert on that key instead of appending, and keep a "last seen" timestamp so new and updated records are easy to tell apart.
4. Log each run's counts (new, updated, skipped) so a bad run stands out at a glance.
It's a small change, but it's the difference between a pipeline people trust and one they double-check every morning.
I'm Faizan, an AI & Full Stack Engineer building automation, LLM apps and dashboards. More at faizanmalik.me
Back to feed
The network for creativity
Join 1.25M professional creatives like you
Connect with clients, get discovered, and run your business 100% commission-free
Creatives on Contra have earned over $150M and we are just getting started