A transit authority builds a ridership star schema job and must keep dimension loads ahead of fact publishes. What should the job DAG enforce?
Select an answer to reveal the explanation.
Short Explanation
Think of bus-stop and route cards (dimensions) hitting the rack before the ridership tickets (facts) get stamped—otherwise the counts have nowhere to hang. It's not about resolving with natural keys, having dimensions reuse fact surrogate keys, or having Type 2 changes update your fact measures — you'll still get orphaned rows and corrupted lookups that way. Make sure your DAG forces dimensions to finish before facts publish.
Full Explanation
In a municipal ridership star schema, dimension tables (routes, stops, vehicles, fare products) must be complete and current before fact publishes land. Lakeflow Job DAGs should therefore encode an explicit precedence edge: dimension load tasks succeed first, then ridership fact publish tasks run so each foreign key can resolve against ready dimension keys. That ordering preserves referential integrity for boardings, alightings, and revenue measures that city planners and FTA-facing reports consume. Without it, fact rows arrive against missing or stale lookups and produce null joins, undercounted corridors, or silently wrong aggregates that still look "green" in a naive row-count check.
Completing dimension loads before fact publishes so facts resolve using natural keys misstates the join purpose because ridership facts must resolve against ready surrogate dimension keys, not source natural keys; natural keys bypass conformed SCD handling and still produce mismatched corridors even when the order is correct. Completing dimension loads before fact publishes so Type 2 changes update fact measures misstates SCD behavior because Type 2 changes insert new dimension versions to preserve history, not rewrite stored fact measures; ridership facts remain immutable and point to the version in effect, so expecting dimension loads to update measures would corrupt historical boardings and revenue reporting. Completing dimension loads before fact publishes so dimensions reuse fact surrogate keys reverses key ownership because dimension surrogate keys must be generated in the dimensions first and then referenced by facts; dimensions cannot borrow keys from facts that have not yet resolved, so this order would deadlock joins and leave ridership facts without ready lookups. Relying on natural-key resolution still risks fact rows landing without resolved dimension keys, producing orphaned rows and incomplete aggregates during the batch window even if dimensions finished first.
Exam caveat: dimension-before-fact is a pipeline design and DAG dependency requirement, not a substitute for SCD correctness, late-arriving dimension handling, or surrogate-key strategies. Those concerns still matter, but the question asks what the job DAG must enforce for publish order. Also distinguish job task dependencies from notebook cell order: only workspace job (or pipeline) dependencies guarantee precedence across runs and retries.
Operational check: after a transit ridership job succeeds, verify dimension task end times precede fact task start times in the run timeline, spot-check that fact foreign keys match dimension keys for the batch date, and confirm dashboards for major routes show non-null dimension attributes. Alert if fact tasks start while any required dimension task is still running or failed.
Prefer to study offline? Printable PDF study book + test engine ($7.50, unofficial). These questions stay free here.