Course contents 16 / 35

16 / 35 · Analytical Warehouses

DWH, data lake and lakehouse

Follow sales from source systems through integration to a serving model. Compare where warehouse, lake and lakehouse designs store the data.

The store and the website both publish sales data. A replay sends the same store event twice. One feed reports a refund as a positive amount and a separate event type. Storing all the files is useful, but adding all their amounts would give the wrong report.

Give each layer a job#

A landing or staging layer preserves the received records and enough information to identify their source and batch. It lets us rerun a transformation against the same input. An integration layer resolves differences between sources. It assigns common units and business keys, maps statuses and handles repeated delivery. A serving layer exposes data in a shape suited to a report or another consumer. These are responsibilities. They can be implemented in separate databases, schemas or collections of tables. (Ross, 2004)

Suppose the store sends a 700-cent sale twice with the same source event ID. The website sends a 600-cent sale and a 350-cent refund. The integration contract says a source event ID identifies one event within its source. It keeps one instance of the repeated sale and stores refunds with a negative sign. The gross sales amount is 1300 cents. After the refund it is 950 cents. Counting both deliveries while applying the refund sign would give 1650. Keeping the raw deliveries lets us inspect why the totals differ.

Figure

Three responsibilities in one report

Three responsibilities in one reportFour deliveries become three distinct signed events. The serving total is 950 cents.Landing4 deliveriesIntegration700 + 600 − 350Serving950 cents
Keep the deliveries, resolve duplicate identity and refund sign, then publish the net amount.

Decide where those layers live#

A data warehouse (DWH) organizes integrated data for analytical access, commonly exposing managed tables and marts. A data lake commonly uses shared file or object storage to retain inputs in several formats. It can preserve exports, logs and other data that a reporting table does not carry. A directory of files can still leave readers to agree on which files form the published table. Separate lake and warehouse copies also introduce a handoff whose freshness and correctness must be managed. (Armbrust et al., 2021, §§1–2)

A lakehouse aims to support warehouse-style tables and other analytical workloads over shared, directly accessible storage formats. A format such as Iceberg tracks schemas and table snapshots above data files. It can make a change to one table visible through a metadata commit. That mechanism does not choose the event key, establish the sign of a refund or prove that two different engines interpret a report identically. The integration and serving contracts remain necessary. (Armbrust et al., 2021, §3; Apache Iceberg, Specification)

For this sales example the same staging, integration and serving responsibilities apply to each design. Their implementations differ in who manages files and tables, which engines can read them, and where an extra copy or refresh is needed.

Next#

The serving layer still needs a definition of one row. Dimensional modeling starts with an order line and shows how quantities, prices and descriptions should appear around that grain.

References#

  1. Margy Ross. Differences of Opinion. Kimball Group, 2004, on source extraction, staging, integration and dimensional presentation.
  2. Michael Armbrust, Ali Ghodsi, Reynold Xin and Matei Zaharia. Lakehouse: A New Generation of Open Platforms that Unify Data Warehousing and Advanced Analytics. CIDR, 2021, §§1–3 on two-tier architectures and the lakehouse proposal.
  3. Apache Software Foundation. Apache Iceberg Table Spec. Describes table metadata, snapshots and atomic replacement of table metadata.