What You'll Master Here
what happened, when it happened, when you saw it, and which payload details need to become columns.
Chapter 6 is about the tables data engineers actually meet in pipelines: product events, timestamps, JSON payloads, arrays, and records that arrive after the day they belong to.
You will separate event time from ingestion time, bucket timestamps safely, extract semi-structured fields, expand arrays into rows, and audit ordering and lateness.
The live labs use SQLite-compatible JSON and date functions, while the article calls out where warehouse dialects differ — the mental model stays stable even when syntax changes.
Separate four things: what happened, when it happened, when you saw it, and which payload details need to become columns.
Event tables power product analytics, attribution, alerting, and pipeline audits. Small timestamp or payload mistakes shift metrics silently, with no error to catch them.
- event_time
- When the user or system action actually happened.
- ingested_at
- When the pipeline received the event.
- payload
- Semi-structured details, often JSON, attached to an event.
- late-arriving data
- A record ingested after the reporting window for its event_time.
| event_id | user_id | event_name | event_time | ingested_at |
|---|---|---|---|---|
| 1 | 1 | view | 2026-01-01 03:30 | 2026-01-01 03:31 |
| 2 | 1 | checkout | 2026-01-01 04:10 | 2026-01-01 04:12 |
| 3 | 2 | view | 2026-01-01 22:15 | 2026-01-02 08:00 |
| 4 | 2 | checkout | 2026-01-02 00:30 | 2026-01-02 00:31 |
| 5 | 3 | view | 2026-01-02 05:00 | 2026-01-04 09:00 |
| 6 | 1 | refund | 2026-01-03 18:00 | 2026-01-03 18:05 |
Events 3 and 5 were ingested a day or more after they happened — that lag is the whole subject of this chapter.
select
event_id,
event_name,
event_time,
ingested_at
from events
order by event_time, ingested_at;| event_id | event_name | event_time | ingested_at |
|---|---|---|---|
| 1 | view | 2026-01-01 03:30 | 2026-01-01 03:31 |
| 2 | checkout | 2026-01-01 04:10 | 2026-01-01 04:12 |
| 3 | view | 2026-01-01 22:15 | 2026-01-02 08:00 |
| 4 | checkout | 2026-01-02 00:30 | 2026-01-02 00:31 |
| 5 | view | 2026-01-02 05:00 | 2026-01-04 09:00 |
| 6 | refund | 2026-01-03 18:00 | 2026-01-03 18:05 |
Six events across three users. Keep this stream in mind — every example below queries it.
Treating event time, ingestion time, and processing time as the same time. Late data, timezone boundaries, and backfills become impossible to reason about.
Name which timestamp you are using.
Order events deterministically.
Decide how late-arriving data should be handled.
Most event bugs are not syntax bugs. They are semantic bugs about time, ordering, payload shape, or whether a record arrived too late for its reporting window.
Use the topic menu as a checklist. Each topic is an event-data habit you should be able to demonstrate on the stream above.
Event SQL is trustworthy when time semantics and payload extraction are visible in the query.
