CYCLS_API_KEY, and Docker if you want to run locally first.
Architecture
One writer, many readers. That split matters, because a volume is shared files with no locking: concurrent writes to the same file are last write wins.1. Create the volume and load a file
2. Write the ingest function
warehouse.py
COPY ... TO takes a literal path, not a bound parameter, so the date is validated before it reaches the SQL string. Writing one file per day makes a rerun idempotent: the same input overwrites the
same partition, which is what makes at-least-once scheduling safe.
3. Backfill with a fan-out
map runs one call per item across autoscaled instances and returns results in
input order.
4. Query it
lake.read_only() means this deployment cannot
modify the warehouse even if the SQL tries. SET enable_external_access = false
stops DuckDB from reading URLs or local paths outside what is already attached.
5. Schedule the ingest
nightly computes the day
itself and delegates to ingest. A rerun overwrites the same partition, which is
what makes at-least-once delivery harmless here.
6. Give an agent access
Deployquery as a named endpoint, then call it from a tool handler.
analyst.py
query
endpoint, which keeps the chat container small and the warehouse in one place.
7. Serve a dashboard from the same data
dashboard.py
ingest writes, query and dashboard
read. Deleting any of them leaves the data untouched.
Operational notes
Next
Scheduled reports
Turn a nightly query into a file users can open.