feat: improve ingestion incremental strategy

This commit is contained in:
Stijnvandenbroek
2026-03-04 21:29:21 +00:00
parent 532bb5138a
commit 9353bdc16d
5 changed files with 72 additions and 10 deletions

View File

@@ -37,5 +37,7 @@ CREATE TABLE IF NOT EXISTS {{ schema }}.listing_details (
saves INT,
raw_json JSONB,
ingested_at TIMESTAMPTZ DEFAULT now(),
last_fetched_at TIMESTAMPTZ DEFAULT now(),
is_stale BOOLEAN DEFAULT FALSE,
UNIQUE (global_id, status)
);

View File

@@ -19,5 +19,7 @@ CREATE TABLE IF NOT EXISTS {{ schema }}.search_results (
broker_name TEXT,
raw_json JSONB,
ingested_at TIMESTAMPTZ DEFAULT now(),
last_seen_at TIMESTAMPTZ DEFAULT now(),
is_active BOOLEAN DEFAULT TRUE,
UNIQUE (global_id)
);

View File

@@ -56,4 +56,6 @@ ON CONFLICT (global_id, status) DO UPDATE SET
views = excluded.views,
saves = excluded.saves,
raw_json = excluded.raw_json,
ingested_at = now()
ingested_at = now(),
last_fetched_at = now(),
is_stale = FALSE

View File

@@ -29,4 +29,6 @@ ON CONFLICT (global_id) DO UPDATE SET
broker_id = excluded.broker_id,
broker_name = excluded.broker_name,
raw_json = excluded.raw_json,
ingested_at = now()
ingested_at = now(),
last_seen_at = now(),
is_active = TRUE