Data models, schema evolution, and lineage
DEA-C01 · Lesson 13 of 23 · 1:41:33
YouTube loads only after you press play. This chapter opens at its timestamp in the full course. Watch on YouTube ↗
Learning with these videos? Subscribe for new courses and exam-style questions.
Subscribe on YouTube (opens in a new tab)In this lesson
Prepare for the DEA-C01 exam (AWS Certified Data Engineer – Associate). In this lesson: Redshift star schemas, distribution styles, and sort keys, DynamoDB keys and secondary indexes designed from access patterns, data lake partitioning, file sizes, compression, and columnar formats, schema evolution with crawler settings, Apache Iceberg, and the AWS Glue Schema Registry and its compatibility modes, and data lineage with SageMaker Catalog and SageMaker ML Lineage Tracking. Includes three original practice questions.
Study notes
The text of this lesson, to read at your own pace. Information as of November 2026.
Slow joins
At AnyCompany Games, dashboard queries on Redshift get slower every week, because each join moves millions of rows between the nodes. A game update added a field to player events and broke a pipeline, and an auditor asks which data trained the churn model. This lesson covers data models, optimization, schema evolution, and lineage.
Data models
In Amazon Redshift, an analytics schema is often a star schema: a large fact table, like matches, joined to smaller dimension tables, like players and maps. Distribute the fact table and its most joined dimension on their common column with KEY distribution, so that matching rows sit on the same slice, and use ALL distribution, or AUTO, for dimensions that cannot be collocated. In DynamoDB, design from the access patterns: the partition key spreads the load, and a sort key groups related items, like all the matches of one player, for range queries with begins with or between. Secondary indexes add other access patterns: a global secondary index can be added at any time, with any key, while a local secondary index keeps the same partition key and must be created with the table. And with Lake Formation, the schema is stored in the Data Catalog as databases, tables, and columns, where permissions and LF-Tags apply down to the column level.
Indexes, partitions, and compression
In Redshift, a sort key lets queries skip blocks, because each one megabyte block stores the minimum and maximum values of its column, and with the auto setting, Redshift chooses the sort key itself. A compound sort key works best when filters use its leading columns in order, while an interleaved sort key gives equal weight to each column, at a higher maintenance cost. Compression shrinks each column and cuts disk reads: automatic encoding is the default, and the COPY command can analyze the data and apply encodings for you. In S3 data lakes, partition on the columns of the most common filters, like the date, but not too finely, because too many partitions make too many small files. Store the data in Parquet or ORC with compression, keep the files large, and use bucketing for lookups on a key with many distinct values, like a player ID.
Schema evolution
Schema evolution is about change: a new column appears, a type gets wider, or a field disappears, and the pipeline must handle each change without breaking. By default, a Glue crawler changes the schema in the Data Catalog to match the data, but you can set it to add new columns only, or to ignore the change and only log it. Open table formats make evolution safe: in Apache Iceberg, adding, renaming, or reordering a column changes only the metadata, without rewriting any data files. For streams, the AWS Glue Schema Registry stores versioned schemas in Avro, JSON Schema, or Protobuf, and checks each new version against a compatibility mode before it is registered. BACKWARD, the recommended mode, lets consumers on the new schema read data written with the previous one, so you can delete fields or add optional fields, but a new required field is rejected.
Lineage
Data lineage shows where data comes from, how it was transformed, and who uses it, which helps you find the source of a quality issue and the impact of a change. Amazon SageMaker Catalog captures lineage automatically from data sources like AWS Glue and Amazon Redshift, and from tools like Visual ETL and notebooks, down to the column level. Its lineage is compatible with OpenLineage, so Spark jobs and other systems can send their own lineage events through the APIs, and each event is versioned to show lineage at any point in time. For machine learning, SageMaker ML Lineage Tracking keeps track of a workflow from data preparation to deployment: training jobs, datasets, models, and endpoints. It creates entities like artifacts, actions, and contexts automatically, so you can query which exact dataset trained a model, for audits and to reproduce it.
Data models at AnyCompany Games
Here is the design at AnyCompany Games: in Redshift, the matches fact table is distributed on the player ID, like the players dimension, and sorted on the match date. In DynamoDB, the match history uses the player ID as the partition key and the match date as the sort key, with a global secondary index by game mode. Events land in the lake as compressed Parquet, partitioned by day, and their schemas sit in the Schema Registry, in BACKWARD mode. And SageMaker Catalog shows the lineage from the raw events to the dashboards, while ML Lineage Tracking links the churn model to its exact training data.
Recap
Let's recap. In Redshift, a star schema puts a fact table at the center, with KEY distribution on the join column and sort keys on the filter columns. In DynamoDB, keys follow the access patterns, and secondary indexes add new ones. In data lakes, partition on common filters, keep files large, and compress them in a columnar format. Crawler settings, Iceberg, and the Schema Registry with its compatibility modes handle schema evolution. And SageMaker Catalog and ML Lineage Tracking show where data comes from, and which data trained a model.
Quick checks for this lesson
The 3 questions of this lesson, as plain text. The button above runs them with shuffled choices and the reason behind every choice.
Dashboard queries join a large Redshift fact table of matches to the players table on the player ID, and every run moves rows across the nodes. What should the data engineer change?
- An interleaved sort key on the date of each match
- KEY distribution on the player ID in both tables
- EVEN distribution on the fact table of matches
- ALL distribution on the large fact table of matches
Show the answer
KEY distribution on the player ID in both tables
With KEY distribution on the join column, matching rows of both tables are stored on the same slice, so the join does not move them. “An interleaved sort key on the date of each match” would help filters on the date, not the join. “EVEN distribution on the fact table of matches” would spread the rows evenly, but the rows to join would still move at every run. And “ALL distribution on the large fact table of matches” would copy the whole fact table to every node, which multiplies storage and load times.
A game update adds an optional field to player events in an Amazon MSK topic. Consumers must still read the older events, and a new required field must never get through. What should the data engineer use?
- A Glue crawler that updates the table definition
- The Schema Registry with the NONE compatibility mode
- Lake Formation permissions on the event columns
- The Schema Registry with BACKWARD compatibility
Show the answer
The Schema Registry with BACKWARD compatibility
BACKWARD lets consumers read the current and the previous version, accepts an optional field, and rejects a new required field. “A Glue crawler that updates the table definition” would change a catalog table, without checking the events in the topic. “The Schema Registry with the NONE compatibility mode” would accept any new version without a check. And “Lake Formation permissions on the event columns” is for access to data, not for the shape of the events.
An auditor asks which exact dataset trained the churn prediction model that runs on a SageMaker AI endpoint. What should the data engineer use?
- SageMaker ML Lineage Tracking, queried for the model
- AWS Glue Schema Registry versions for the dataset
- A Glue crawler with incremental crawls on the bucket
- S3 versioning on the bucket of the training data
Show the answer
SageMaker ML Lineage Tracking, queried for the model
ML Lineage Tracking links the training job to its input datasets, so a lineage query returns the exact data that trained the model. “AWS Glue Schema Registry versions for the dataset” would follow the shape of the events, not which data trained a model. “A Glue crawler with incremental crawls on the bucket” would add new partitions to the catalog. And “S3 versioning on the bucket of the training data” would keep old versions of files, without linking any of them to the model.