The Data Vault model is full of patterns; deterministic, finite patterns. One of the benefits and objectives of this is to allow the automatic generation of loading routines (ETL / ELT, SQL, Stored Procedures etc…) In this entry I dive a little deeper into the pattern side of loading the Data Vault. What drives it, why it is architected this way, how it works – and how easy/hard it might be to setup your own “generation of code” for loading patterns.
What Drives the Patterns? Why is it architected this way?
It really comes down to efficiency. When building the DV architecture and rules, it seemed like a good idea to apply design patterns. I was knee deep in SEI/CMMI Level 5 at the time, and we were all about business process optimization. I figured that one way to optimize the IT business, was to ensure that the Data Warehouse Data Model could be built in a repetitive fashion. So, the Data Vault model follows strict rules which allow it to adhere to common and consistent patterns. The other driver for the model was quite simply:
I was tired of “building” mundane data flows, over and over and over again. You see, I’m a reductionist at heart (when it comes to implementation, long-winded when it comes to blogging)… Quite simply put, I had no time or money to “hire” new resources to do the grunt work for me, and we had a deadline looming. I placed my hope in the “patterns” and rule-sets that govern the Data Vault model, and built my first ETL code generator.
What do I need to understand in order to write my own generator?
First, be able to “classify” or categorize data models. For instance: are they 3NF (normalized – sort of), Staging (separate/distinct tables mostly), Data Vault (Hub, Link, Satellite), Star Schema (Dimension, Degenerate Dimension, Fact). Once the model classification has been done, then table classification needs to be done (as I just mentioned, determining table type is important). Why? Because you will need one kind of code to load “Dimensions”, while you need a different kind of code to load “facts”. But in the end, all Dimensions should load the same way, while all facts should load the same way.
In other words, pattern based designgs – or template driven code generation.
The Data Vault Loading patterns are grouped as follows:
- Database to Database
- Flat file to Database
Then, they are sub-divided into additional patterns:
- Source to Stage
- Source to Hub
- Source to Link
- Source to Satellite
- Stage to Hub
- Stage to Link
- Stage to Satellite
and so on. Understanding these patterns yields a good chance of designing an appropriate template to match, from there it’s also a matter of understanding or knowing what the properties are of the target table.
So what’s the secret?
There really isn’t one, but if you need it: it’s a rule of thumb I learned long ago in performance and tuning across many different ETL tools (running 1.1 billion rows through a single process at high speeds…. etc…) the SECRET as it were is: design your ETL – 1 target per data flow per action. Where ACTION may be insert, update, delete – and the 1 target – well that speaks for itself.
Not only will this simplify your data loading paradigms, it will reveal the EASY to pattern loading routines – it has the added benefit of a) being restartable – when designed properly, and b) being high performant out of the gate, and c) easily parallelized or shared over a grid (partitioned).
So, discover the patterns for loading the Data Vault (I’ve shared some here), and follow the basic rules with the “secret” mentioned above, and you should have major success.
Please feel free to comment on what’s here – offer your insights as it were.
Hope this helps,