Notes

Part 4 of 10

From data warehouse to data lake

Warehouses are usually relational and queried with SQL. That suits business analysts well, but data scientists less so. Data scientists often need to:

  • turn records into lists of numbers that a machine learning model can learn from, called feature engineering, which often needs custom code;
  • analyze text, for example the mood or topic of rider reviews (natural language processing);
  • analyze images or video (computer vision).

So many data scientists prefer Python data libraries, R, or Spark over a warehouse.

A data lake is a central store for copies of any data that might help analysis, filled by ETL from operational systems. Unlike a warehouse, a lake is just files, with no fixed format, data model, or schema.

  • Files can be database records in formats like Parquet or Avro, but also text, images, video, sensor readings, model inputs, or anything else.
  • Lakes are flexible and often cheaper, because they sit on plain file storage such as object stores.
  • ETL has grown into general data pipelines, and a lake may be one stop on the way from operational systems to a warehouse.
  • Because the lake keeps data in its raw form, each user can transform it to fit their own needs. People sum this up as the sushi principle: data is better raw than cooked.

Beyond the data lake

  • More attention now goes to running analytics systems and pipelines well, an approach sometimes called DataOps. Part of the push comes from governance, privacy, and laws like GDPR and CCPA.
  • Analytics data increasingly arrives as event streams, not just as files and tables. A file-based job might rerun once a day, while a stream job reacts within seconds. That speed matters when time counts, such as blocking a stolen card or stopping abuse.
  • Reverse ETL sends the results of analytics back into operational systems. For example, a model trained on ride history in the analytics system is deployed into the app to suggest stations.

Systems of record and derived data

  • A system of record (or source of truth) holds the official version of the data. New data is written there first, each fact is stored once (usually normalized), and if anything disagrees with it, the system of record wins by definition.
  • A derived data system holds data made by taking data from another system and transforming it. If you lose derived data, you can rebuild it from the source.
  • A cache is the classic example: serve the answer from the cache if it is there, otherwise go to the database. Other derived data includes denormalized values, indexes, materialized views, data reshaped into another form, and trained models.
  • Derived data repeats information that exists elsewhere, but it is often what makes reads fast. One source can feed many derived views, each looking at the data in a different way.
  • Analytical systems are usually derived. An operational service can have both: its main database is a system of record, while its cache and search index are derived.
  • Whether a tool is a system of record depends on how you use it, not on the tool itself.
  • Drawing which data comes from which source makes a messy architecture much easier to understand.
  • Something must update derived data when the source changes. Many databases act as if they are your only database, which makes this harder; a later chapter covers pipelines that connect systems.

One source, many copies

Step 1 of 4

A write goes to the system of record first: station 4 now has 11 bikes. The cache, search index and warehouse still say 12.