🧭Schema-on-Read
Also known as Schema on Read
Store data as it comes. The shape is set later, when it is read.
Think of it like
It is like a big box you throw toys into. You sort them only when you want to play.
Example
A team dumps raw JSON logs into a data lake each day. Months later, an analyst reads just the city field from them.
Why it matters
You can keep data before you know what you will ask of it. New questions do not need a reload.
Definition
Example code
sql
SELECT doc->>'city' AS city, COUNT(*)
FROM raw_events
GROUP BY 1;Common mistake
Key takeaways
- 1Load as is. No shape is forced on the way in.
- 2Shape at query time. The reader picks fields and types.
- 3Errors show late. Bad data is found on read.