Menu

1 / 3

LLM Columns in dbt Break Idempotency. Cache by Hash, Not Run

DEV Community: datascience·AI Explore·4 days ago
#Cx7i99ZF
#devtodatascience#science#devto#dev#model
Reading 0:00
15s threshold

TL;DR — A dbt model is supposed to be a pure function of its inputs. An LLM call inside a model is not, so full refreshes, CI diffs, and tests all quietly stop meaning what they used to. Treat LLM-derived columns as a content-addressed ledger keyed on input, prompt, and model identity, and let dbt join to it instead of regenerating it.

The most seductive thing a modern warehouse can do for an AI team is let you call a model from SQL. Classify a support ticket, extract an entity, summarize a contract. One expression in a SELECT, wrapped in a dbt model, and you have an "enriched" table that refreshes on schedule.

It works on day one. It is also a quiet violation of the contract that makes dbt worth using. My thesis: an LLM call is not a transformation, it is an observation, and you should store it like one.

The contract you didn't know you were relying on

dbt's whole workflow rests on an assumption that rarely gets stated: a model is a pure function of its upstream relations plus its code.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.