Lesson 2 of 5 Schema Evolution and Data Lineage

Managing Schema Evolution Without Breaking Consumers

This lesson explains how to manage schema changes, columns added, renamed or changed in type, without breaking pipelines and consumers, a recurring data engineering task as sources and requirements evolve.

Learning outcomes

After completing this lesson, you will be able to:

  • Distinguish compatible from breaking schema changes.
  • Use crawler policies, Iceberg and schema registries to handle evolution.
  • Apply good practice for additive, backward-compatible changes.

Types of change

Schema changes differ in whether existing consumers keep working. Adding an optional column is low risk, because existing readers simply ignore it. Widening a type, such as from int to bigint, is also low risk in most engines, since every old value still fits. Renaming or dropping a column is high risk: queries and jobs that reference it fail, or silently read nulls. Changing a type incompatibly, such as from string to integer, is high risk because parsing fails. High-risk changes need coordination with consumers, and registries such as the Glue Schema Registry can enforce compatibility rules. The following table summarises the changes.

ChangeRisk
Add an optional columnLow; existing readers ignore it
Widen a type, such as int to bigintLow in most engines
Rename or drop a columnHigh; readers expecting it fail or read nulls
Change a type incompatiblyHigh; parsing fails

The following diagram compares renaming a column in plain Parquet files and in an Iceberg table.

Renaming zip to postcode in plain Parquet compared with Iceberg. Plain Parquet resolves columns by name, so old files have no postcode column and return nulls. Iceberg tracks each column by ID, so the rename applies to every existing file without rewriting data, and old snapshots stay readable.
The column ID is illustrative.
Sort into groups

Risky schema change?

Exam skills 2.4.2

Decide whether each schema change is low or high risk for consumers.

Log in to try this activity Interactive activities are free with an account.

Tools for schema evolution

Source systems change their schemas over time, and pipelines must handle those changes without failing or corrupting data. AWS Glue crawlers have schema change policies that decide what happens when they detect a change: update the table definition, add new columns only, or only log the change for review. In Glue jobs, the DynamicFrame resolveChoice transformation resolves columns whose type differs between records, for example by casting them to one type.

Table formats help at the storage layer. Apache Iceberg supports schema and partition evolution without rewriting data, because it tracks columns by ID rather than by name or position, so columns can be added, renamed or reordered safely. Spark can merge Parquet schemas that differ between files, and for streaming data, Avro schemas managed in a schema registry control how record structures change.

Match the pairs

Evolution tools

Exam skills 2.4.2 · 2.2.3

Match each schema evolution problem with the tool.

Log in to try this activity Interactive activities are free with an account.

Good practice

Schema changes are managed so that they do not break the consumers who depend on the data. The safest changes are additive and backward compatible: adding a new optional column leaves existing queries working, whereas renaming a column or changing its type breaks every query and job that uses it.

Schemas are versioned, and producers and consumers agree data contracts that define the schema, its meaning and the rules for changing it. When a breaking change is unavoidable, it is announced well in advance, and the old and new versions are published side by side during a migration period, so consumers can move to the new version at their own pace before the old one is retired.

Worked example

A source adds and renames columns

A source system adds a loyalty_tier column and renames zip to postcode. The curated table is plain Parquet registered by a crawler, and the rename makes old files return nulls for the new name. After moving the table to Iceberg, the same changes are applied as follows.

ALTER TABLE curated.customers ADD COLUMNS (loyalty_tier string);
ALTER TABLE curated.customers CHANGE COLUMN zip postcode string;

Iceberg tracks columns by ID, so the rename applies to every existing file without rewriting data, and old snapshots remain readable. The producer and consumers also agree to treat future renames as breaking changes that need notice under the dataset's contract.

Check yourself

What kind of schema change is safest?

Show answer

An additive, backward-compatible change, such as adding an optional column.

Exam Tips

Remember for the exam

  • Prefer additive, backward-compatible schema changes.
  • To add or rename columns without rewriting data, use Iceberg schema evolution.
  • Glue crawler schema change policies decide whether tables update automatically.
  • Use resolveChoice in Glue for conflicting column types.
  • Renaming or dropping columns breaks consumers unless managed carefully.