File formats & storage · Extra High-Value

Schema-on-read vs schema-on-write

Easyschema-on-readschema-on-writelakewarehousecontracts

Interview question

What is the difference between schema-on-read and schema-on-write?

How to answer

The short answer

Schema-on-write validates and applies a schema when data is ingested. Bad records fail early (or land in a quarantine). Warehouses and typed pipelines lean this way.

stores data more loosely (, text, raw files) and interprets structure when you query. Classic data lakes leaned this way for flexibility.

Output
Schema-on-write:
  source -> validate schema -> typed Parquet/Delta table -> query

Schema-on-read:
  source -> dump raw files -> query engine guesses/applies schema at read

Trade-offs

Schema-on-writeSchema-on-read
IngestStricter, more upfront workFast landing, flexible
QueryPredictable typesSurprises, cast errors later
QualityFail earlyFail late (dashboards break)

Modern practice

Lakes still land raw zones, but curated Bronze→Silver→Gold (or Medallion) layers move toward schema-on-write with contracts. Table formats enforce schemas at write when configured.

Interview tip: Do not treat schema-on-read as "always wrong." Say raw landing can be flexible; analytics tables should be enforced.