my prefect server setup prefect-metrics.waow.tech
python orchestration
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix compact: query raw tables instead of dbt views

dbt staging models are materialized as views whose definitions reference
a catalog path that doesn't survive the DuckDB snapshot copy. query raw
tables directly with inline dedup instead.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

zzstoatzz e1b28a37 8c6b8460

+7 -4
+7 -4
flows/compact.py
··· 87 87 """Read observations for a specific user, formatted as text.""" 88 88 db = duckdb.connect(snap_path, read_only=True) 89 89 rows = db.execute( 90 - "SELECT content, tags, created_at FROM stg_phi_observations " 91 - "WHERE handle = ? ORDER BY created_at DESC", 90 + "SELECT DISTINCT ON (observation_id) content, tags, created_at " 91 + "FROM raw_phi_observations " 92 + "WHERE handle = ? ORDER BY observation_id, fetched_at DESC", 92 93 [handle], 93 94 ).fetchall() 94 95 db.close() ··· 105 106 """Read interactions for a specific user, formatted as text.""" 106 107 db = duckdb.connect(snap_path, read_only=True) 107 108 rows = db.execute( 108 - "SELECT content, created_at FROM stg_phi_interactions " 109 - "WHERE handle = ? ORDER BY created_at DESC LIMIT 20", 109 + "SELECT DISTINCT ON (interaction_id) content, created_at " 110 + "FROM raw_phi_interactions " 111 + "WHERE handle = ? ORDER BY interaction_id, fetched_at DESC " 112 + "LIMIT 20", 110 113 [handle], 111 114 ).fetchall() 112 115 db.close()