Contents
- Opening essay: Unglamorous data
- What is data?
- Data and organisations
- What is data engineering?
- The principles of data engineering
- Expressiveness and fragment modelling
- Mapping the data world
- Entity processing
- Entity tracking
- Reference data
- Integrating systems
- Storytelling
- Meaningful fragments
- Affordance
- The craft of dimensional modelling
- A good dimensional model
- Dimensional modelling for UX
- Filtering behaviour
- Designing measures
- Measure of measures
- Interactive row level security
- Anticipating questions
- Efficiency and stability
- Load mechanics
- Load orchestration
- Load dependencies
- Incremental load: tracking changes
- Incremental load: responding to change
- Acquiring information
- Optimising Power BI load
CI/CD
Dev is a shadow of prod.
Train like you fight
Train like you fight is a well-known principle of military training. It says that training should be as close as possible to the real conditions it prepares for, so that nothing in the real event is encountered for the first time.
This is equally true of a data engineering pipeline.
A data engineer needs a reliable place to prove a change before it reaches the user. The proof is only as good as its resemblance to the real thing. A change that has only been proven against conditions unlike production has not been proven.
In this view:
Dev is a shadow of prod.
Dev is seen as a pre-run of prod, and therefore “prod plus change”.
This inverts the common mindset, in which code cycles from development, through testing, to production, with production as the last stop. But this mindset shift is necessary for mature data engineering.
Once prod becomes the fixed point in a data engineer’s mind, a lot of design confusion is resolved automatically. Prod is the authoritative system. Dev is a working representation of that system, with proposed changes.
Several engineering decisions follow naturally:
- Data ownership. Prod holds the authoritative data. Dev reads production data where it can, through a copy, clone, or pointer, rather than producing its own.
- Selective development. Only the objects being changed, and the objects that depend on them, need to be local to dev and rebuilt there. Everything else can be read from prod.
- Multiple developers. Because each shadow holds only what is being changed, each developer or team can maintain a separate shadow without duplicating the entire production estate.
- Deployment. What is promoted is the tested code and definitions. The development environment and its data are not promoted.
This is exercised through CI/CD, which is the practice of moving code through environments, integrating and deploying it repeatedly and reliably. Because of train like you fight, its principle in data engineering is the fidelity of environments:
- fidelity of code;
- fidelity of data;
- fidelity of infrastructure.
Three types of fidelity
Fidelity of code
Code should be, as far as possible, identical in each environment.
This is harder than it sounds. Much code has environment-specific details buried in it: a workspace name, a connection string, a server, a hard-coded path to a development table. Each one is a difference between what was rehearsed and what runs in production.
Eliminating environment-specific code requires a strong grasp of the infrastructure and the options it offers. It requires discipline, and often creativity.
Ideally, identical code can be deployed to different environments by changing only the deployment code, while the internal variables remain unchanged.
This means that every reference is logically declared, not substituted. A notebook refers to the Sales database, not to a development database whose name is found and replaced on the way to production. Which Sales database is meant is resolved by the environment the code is deployed into.
Templating that rewrites references into each environment at compile time is still substitution. So is code that checks which environment it is running in and behaves differently. In both cases, the code that runs in production is not quite the code that was rehearsed.
Fidelity of data
Wherever possible, development should use a faithful copy of production data.
This requires the development environment to have production-level security and controls. This was not often possible in the past. It is becoming more common as standards in data and controls lift, and it requires a partner in infrastructure to provide it.
There are four ways to bring production data into development:
- Occasional copy. Production data is copied into development from time to time.
- Parallel run. The pipeline runs in parallel in both environments, sometimes off a single copy of the source data, to avoid hitting the source system twice.
- Clone. Modern platforms allow a shallow clone of a table, which shares the underlying storage rather than copying it.
- Pointer. Development refers to production data through a synonym or shortcut rather than holding a copy. This requires the pointer to be swapped for a real table wherever the change being made writes to that table.
Where this is not possible, development falls back on samples, fake data, or anonymised data. Each is a step away from the real thing, and the rehearsal is weaker for it.
Fidelity of infrastructure
There are two types of infrastructure fidelity.
The first is functionality: the same functions, versions, and editions of the platform in each environment. A feature available in development but not in production is a failure waiting to be deployed.
The second is performance. As much as possible, the environments should have the same capacity, so that a load that runs in minutes in one environment does not run for hours in another. At the least, this is required for preprod, where complete runs are rehearsed.
Deployment environments
Dev is seen as a pre-run of prod, and therefore “prod plus change”. In most cases, two environments, dev and prod, are enough.
But a more serious enterprise may need up to five:
| Environment | Purpose | When it is needed |
|---|---|---|
| Dev | Build, experiment, break things, and fix them without affecting anyone else. | From the start, once anyone relies on prod. |
| UAT | Users test the proposed changes and confirm they meet their needs. | When users need to sign off on changes before release. |
| Integration | Code from different teams is brought together and checked for compatibility. It may have little or no data. It is the equivalent of a Git merge, but for deployed objects. | When several teams change the same platform at once. |
| Preprod | An environment that closely resembles prod, where complete runs are rehearsed before release. | When a failed release would be costly, or loads are large enough that timing matters. |
| Prod | The real system that users and downstream processes depend on. | Always. It is the fixed point. |
Whatever the number of environments, the mental model does not change. Prod is the real system. The other environments exist to rehearse changes to it faithfully.
Automation
Achieving real fidelity across environments requires a strong automation framework: one that deploys the same code the same way every time, resolves logical references into each environment, and brings data into development by the chosen method.
Key ideas
Train like you fight. A change is only proven under conditions that resemble production.
Dev is a shadow of prod. It is a pre-run of prod, “prod plus change”.
Once prod becomes the fixed point, a lot of design confusion is resolved automatically.
The principle of CI/CD in data engineering is the fidelity of environments: of code, of data, and of infrastructure.
Every reference is logically declared, not substituted.
Production data reaches development by occasional copy, parallel run, clone, or pointer. Samples, fake, or anonymised data are the fallback.
Achieving fidelity requires automation.
Most teams need only dev and prod. A more serious enterprise may need up to five environments.