We know what a data architecture is and why it is worth the investment. What remains is to see what it is made of. However different organizations and the technologies they use may be, almost every data architecture can be described with the same pieces: data that is born somewhere, gets collected, stored, transformed and made available to whoever needs it, all under a common set of rules.
This lesson is an end-to-end tour of those pieces. It works as the map of the course: for each component we will see what function it performs, what questions it forces you to answer and in which module we will study it in depth. We will not go deep into any technology; the goal is that, by the end, you can place any tool or concept you come across where it belongs, and that you are able to draw the map of a real organization, starting with DataCorp.
The reference architecture: the big picture
A reference architecture is a generic diagram, independent of specific products, that serves as a template for understanding and comparing real architectures. The one we will use in the course has five stages through which data flows, from left to right, and six cross-cutting layers that affect every stage.
flowchart LR
subgraph F["1. Sources"]
F1["Operational<br/>databases"]
F2["Applications<br/>and APIs"]
F3["Files"]
F4["Events"]
end
subgraph I["2. Ingestion"]
I1["Batch"]
I2["Streaming"]
end
subgraph A["3. Storage"]
A1["Raw data"]
A2["Cleansed and<br/>integrated data"]
A3["Consumption-ready<br/>data"]
end
subgraph P["4. Processing"]
P1["Cleaning, integration<br/>and aggregation"]
end
subgraph C["5. Serving and consumption"]
C1["Reports and<br/>dashboards (BI)"]
C2["Exploratory<br/>analysis"]
C3["Machine learning<br/>models"]
C4["Other<br/>applications"]
end
F --> I --> A1
A1 --> P1 --> A2
A2 --> P1
P1 --> A3
A3 --> C
T["Cross-cutting layers: governance · metadata · quality · security · orchestration · monitoring"]
T -.- F
T -.- I
T -.- A
T -.- P
T -.- C
Three observations before going into each piece:
- Data flows in one direction. From the sources to consumption. When a report shows a wrong figure, the error is located by walking this path backward.
- Storage and processing alternate. Data is stored, processed, stored again in a more refined form, and so on. They are not two consecutive steps, but a cycle.
- The cross-cutting layers are not a final stage. Security or quality are not "added at the end"; they are present at every stage.
Data sources
The sources are the systems where data is born. They have one decisive characteristic: the data team does not control them. They exist to run the business, not to make analysis easier, and their owners can change them without warning.
| Type of source | Examples | Peculiarity |
|---|---|---|
| Operational databases | The orders database, the ERP | They are critical: extracting data must not harm them |
| Third-party applications and APIs | Advertising platforms, ticketing tool | They impose usage limits and change versions |
| Files | CSV, spreadsheets, exports | Unreliable format; they usually depend on one person |
| Event streams | Clickstream, sensors, application logs | High volume and continuous arrival |
Questions the architecture must answer about each source:
- Who is responsible for it and how can they be contacted?
- What volume does it generate and how fast does it change?
- How can it be accessed without harming it?
- How reliable is it and how often does its structure change?
Ingestion
Ingestion is the process of bringing data from the sources into the data platform. It is the border between the operational world and the analytical one that we described in the first lesson.
There are two basic modes:
| Mode | How it works | When it is used | Example |
|---|---|---|---|
| Batch | The accumulated data is collected at regular intervals | When data from a few hours ago or from the previous day is good enough | Loading the day's orders every night |
| Streaming | Each piece of data is collected as soon as it is produced | When the value of the data depends on its immediacy | Collecting website clicks as they happen |
To make the idea concrete, this snippet illustrates batch ingestion in its simplest form: reading yesterday's orders from the transactional database and leaving them, unmodified, in a file.
# Illustrative example of batch ingestion: extract yesterday's orders
# and store them as-is in the raw data zone
import csv
from datetime import date, timedelta
import psycopg2 # library for connecting to PostgreSQL from Python
yesterday = date.today() - timedelta(days=1)
connection = psycopg2.connect(host="orders-replica.datacorp.example", dbname="store",
user="ingestion_reader", password="********")
cursor = connection.cursor()
# Only the rows for the given day are requested: an incremental extraction
cursor.execute(
"""
SELECT order_id, customer_id, order_date, status, total_amount
FROM orders
WHERE order_date >= %s AND order_date < %s
""",
(yesterday, yesterday + timedelta(days=1)),
)
# The file is named after the date of the data so it can be located and reloaded
path = f"raw/orders/orders_{yesterday.isoformat()}.csv"
with open(path, "w", newline="", encoding="utf-8") as file:
writer = csv.writer(file)
writer.writerow([column[0] for column in cursor.description]) # header
writer.writerows(cursor.fetchall()) # data
connection.close()The points that matter, beyond the syntax:
- Only what is new is extracted (
WHERE order_date >= ...). Copying the entire table every night would get slower and slower. This is called incremental extraction. - It reads from a replica, not from the primary database (
orders-replica), so as not to compete with the store. - The data is stored untransformed. Ingestion moves data; transforming it is the job of the processing stage. Keeping a faithful copy of the source makes it possible to redo any later calculation.
- The file carries the date in its name. If one day's load fails, only that day's load needs to be repeated.
In a real system this work is done by specialized tools, with error handling, retries and credential management. Integration techniques are covered in Module 3, and extraction and loading processes in Module 4.
Storage
Storage is where data resides inside the platform. It is not a single repository: the usual approach is to organize it into zones according to how refined the data is.
| Zone | Contents | Who uses it | Analogy |
|---|---|---|---|
| Raw data | Faithful copy of the sources, unmodified | Data engineers | The raw material arriving at the warehouse |
| Cleansed and integrated data | Clean data, with unified formats and combined sources | Engineers and advanced analysts | The parts, already inspected and sorted |
| Consumption-ready data | Data modeled to answer business questions, with the official metrics | Analysts, reporting tools | The finished product in the shop window |
Decisions this component raises:
- Which type of system suits each class of data (relational, document, file, object...).
- Whether it is hosted on-premises or in the cloud.
- Which data model is adopted in each zone.
- In which format files are stored and how they are split up so that queries are fast.
All of this is the content of Module 2. The major analytical storage patterns (data warehouse, data lake and data lakehouse) are studied in Module 6.
Processing and transformation
Processing turns raw data into useful data. It is the step from one storage zone to the next. The typical operations are:
- Cleaning: removing duplicates, fixing formats, handling missing values.
- Integrating: combining data from several sources that talk about the same thing.
- Applying business rules: implementing the official definitions of the metrics.
- Aggregating: summarizing the data at the level of detail each use needs.
An example. The previous lesson ended with a provisional definition of net sales. A transformation is the place where that definition is written exactly once:
-- Illustrative transformation: from cleansed orders to daily net sales
CREATE TABLE consumption.daily_net_sales AS
SELECT
CAST(order_date AS DATE) AS sales_date,
COUNT(*) AS num_orders,
ROUND(SUM(total_amount) / 1.21, 2) AS net_sales -- without VAT
FROM cleansed.orders
WHERE status NOT IN ('cancelled', 'returned') -- business rule
GROUP BY CAST(order_date AS DATE);What it does:
- It reads from the cleansed zone (
cleansed.orders) and writes to the consumption zone (consumption.daily_net_sales). CAST(order_date AS DATE)discards the time in order to group by day.- The
WHEREclause and the division by 1.21 are the agreed business rule.
From here on, any report that needs net sales queries this table instead of recalculating it. If the definition changes, it is modified in a single place. This is how an architecture decision solves the problem of contradictory figures.
Processing can be done in batch or in streaming, before or after loading the data, and with a wide variety of tools. All of this is developed in Module 4.
Serving and consumption
The last stage is the only one users see, and the one that gives meaning to the earlier ones. It is worth distinguishing two ideas:
- Serving: the way the platform exposes the data (queryable tables, APIs, exported files, a metrics layer with business definitions).
- Consumption: what people and systems do with it.
| Type of consumption | Question it answers | Typical user | Example at DataCorp |
|---|---|---|---|
| Reports and dashboards (BI) | What happened? | Management, area heads | Daily net sales by category |
| Exploratory analysis | Why did it happen? | Analysts | Why returns went up in September |
| Machine learning (ML) | What will happen? | Data scientists | Demand forecast by product |
| Operational applications | Analytical data fed back into operations | Other systems | Product recommendations in the store |
BI stands for business intelligence and ML for machine learning. Analysis, its tools, business metrics and visualization are covered in Module 5.
A principle worth holding on to from now on: the architecture is designed starting from consumption. First you identify which questions need to be answered and, from there, you decide what data is needed, how fresh and in what form. We will develop this in the next lesson.
Cross-cutting layers
The six cross-cutting layers do not move data from one place to another, but they determine whether the whole is reliable, secure and sustainable. They are the most neglected and the most sorely missed.
| Layer | Question it answers | What happens if it is missing |
|---|---|---|
| Governance | Who decides about each piece of data, and under which rules? | Nobody is accountable for anything; everyone defines things their own way |
| Metadata | What data do we have, what does it mean and where does it come from? | "Nobody knows what data exists" |
| Quality | Is the data correct, complete and up to date? | Decisions based on wrong data |
| Security and privacy | Who can see and do what? Is personal data protected? | Information leaks and fines |
| Orchestration | Which process runs, when and in what order? | Processes that step on each other or work with half-loaded data |
| Monitoring | Is everything working as it should? | Users are the ones who discover the failures |
Some vocabulary clarifications:
- Metadata is "data about data": the name of a table, the description of a column, its owner, the date of the last update. Lineage is the metadata that describes the path a piece of data has followed from its origin.
- Orchestration coordinates the tasks. If the net sales transformation starts before the orders ingestion has finished, it will calculate an incomplete figure without anyone receiving an error.
- Monitoring watches over both technical health (has the process finished?) and data health (have the expected rows arrived?).
The first four layers are studied in Module 3; orchestration, in Module 4; and monitoring, in Module 7.
Summary table: the map of the course
This table brings together everything above. The technologies mentioned are only representative examples so that you can recognize them; you do not need to know them now.
| Component | Function | Example technologies | Where it is covered in depth |
|---|---|---|---|
| Sources | Generating the data in the business systems | PostgreSQL, MySQL, ERP, CRM, third-party APIs, CSV files | Module 2 (types of storage) and Module 3 (integration) |
| Ingestion | Bringing data from the sources into the platform | Airbyte, Fivetran, Debezium, Apache Kafka | Module 3 (integration) and Module 4 (ETL, ELT, batch and real time) |
| Storage | Keeping the data at its different degrees of refinement | Amazon S3, Azure Data Lake Storage, Google Cloud Storage, Snowflake, BigQuery, Redshift, PostgreSQL, MongoDB | Module 2; overall patterns in Module 6 |
| Processing and transformation | Cleaning, integrating and applying the business rules | SQL, dbt, Apache Spark, Apache Flink | Module 4 |
| Serving and consumption | Exposing the data and using it to analyze and decide | Power BI, Tableau, Looker, Metabase, Jupyter notebooks | Module 5 |
| Governance | Assigning responsibilities and rules over the data | Policies, committees and roles; platforms such as Collibra | Module 3 |
| Metadata | Cataloging the data, its meaning and its lineage | DataHub, OpenMetadata, Apache Atlas | Module 3 |
| Quality | Measuring and ensuring that the data is correct | Great Expectations, Soda, dbt tests | Module 3 |
| Security and privacy | Controlling access and protecting personal data | Role-based access control, encryption, masking | Module 3 |
| Orchestration | Coordinating the execution of the processes | Apache Airflow, Dagster, Prefect | Module 4 |
| Monitoring | Watching over operation and detecting failures | Prometheus, Grafana, data observability tools | Module 7 |
Modules 6 and 7 do not add new components: Module 6 studies the most widespread ways of combining these pieces, and Module 7, how to implement them, scale them and control their cost. Module 8 brings them all together in the DataCorp final project.
The map applied to DataCorp: current state (as-is)
Marta's first deliverable is not a proposal, but a diagnosis. Before designing the future (what is known as the to-be state), she draws the current situation (the as-is state) using the reference architecture as a template. To do so, she spends two weeks with Íñigo tracing each report back to its origin.
flowchart LR
subgraph F["Sources"]
PG[("PostgreSQL<br/>customers, products,<br/>orders, order_lines")]
ERP[("Warehouse ERP<br/>inventory")]
MK["Marketing<br/>CSV and APIs"]
CS["Clickstream<br/>JSON events"]
TK["Customer support<br/>tickets"]
end
subgraph I["Ingestion"]
SC["Nightly SQL scripts<br/>(cron, 02:00)"]
EX["Nightly CSV export<br/>from the ERP"]
MAN["Manual download"]
end
subgraph A["Storage"]
CARP["Shared folder<br/>with CSV files"]
SRV["Disk of a server<br/>with JSON files"]
end
subgraph P["Processing"]
XLS["Each department's<br/>spreadsheets"]
end
subgraph C["Consumption"]
INF["Reports by email"]
BIM["Marketing's<br/>reporting tool"]
BIF["Finance's<br/>reporting tool"]
end
PG -->|"direct query<br/>against production"| SC
SC --> CARP
ERP --> EX --> CARP
MK --> MAN --> CARP
CS --> SRV
CARP --> XLS
XLS --> INF
PG -->|"direct query"| BIM
PG -->|"direct query"| BIF
TK -.->|"not connected"| C
SRV -.->|"nobody analyzes it"| C
What the diagram reveals
Component by component:
| Component | Current state at DataCorp | Problem |
|---|---|---|
| Sources | Five sources, with no identified owners | Nobody gives notice when a structure changes |
| Ingestion | Scripts launched with cron at 02:00 against the production database; nightly export from the ERP; manual downloads by Marketing |
Analytical workload on the transactional system; dependence on specific people |
| Storage | A shared folder with CSV files; clickstream JSON files piled up on a server's disk | No reliable history, no zones, no guaranteed backup |
| Processing | Spreadsheets that each department maintains on its own | The business rules are hidden in formulas and differ in each area |
| Consumption | Reports sent by email; two reporting tools connected directly to production | Several versions of each figure; more load on the store |
| Governance | Nonexistent | Nobody is accountable for the data |
| Metadata | The knowledge is in people's heads | "Nobody knows what data exists" |
| Quality | No checks | Management is the one that discovers the errors |
| Security | Shared credentials; files with personal data in open folders | Risk of non-compliance with the GDPR |
| Orchestration | cron, with no dependencies between tasks |
A script can start before the previous one has finished |
| Monitoring | Only the store's | Report failures are detected in the morning |
Three findings sum up the diagnosis:
- Three arrows go directly to the production database carrying analytical workload. This is the cause of the outages.
- Two sources lead nowhere. Tickets and clickstream are not analyzed: this is data that is paid for and not used.
- The six cross-cutting layers are empty. DataCorp's three starting problems (numbers that don't match, reports that bring down the store and data with no owner) correspond almost literally to the absence of governance, of separation between operations and analysis, and of metadata.
This map is the starting point of the course. Each module will replace one part of it until we arrive, in the final project, at the target architecture.
Common Mistakes and Tips
- Starting with the tools. Asking "which reporting tool do we use?" before knowing what data there is and what you want to answer leads to buying pieces that do not fit. First the map; then the products.
- Forgetting the cross-cutting layers. This is the most frequent mistake: the data flow gets built and quality, security or documentation are left "for later". Adding them afterward costs far more.
- Confusing ingestion with transformation. If the data is modified while it is being extracted, the faithful copy of the source is lost and nothing can be redone when a rule changes. It pays to keep the two responsibilities separate.
- Drawing only the future state. Without a diagram of the current state you cannot measure progress or plan the transition.
- Thinking that each box is a different product. A single tool can cover several components, and one component may require several tools. The reference architecture describes functions, not a shopping list.
- Tip: to build the as-is map, follow the reports backward. Pick an important report and ask at every step "and where does this data come from?" until you reach the source. It is usually more reliable than any existing documentation.
Exercises
Exercise 1: Placing each piece on the map
State which component or cross-cutting layer of the reference architecture each item corresponds to:
- A process that copies the new rows of
inventoryto the platform every hour. - A document that defines "active customer" as one with at least one order in the last 12 months, and states who owns that definition.
- An alert that notifies Íñigo if the night's orders load contains fewer than 1,000 rows.
- A dashboard showing daily net sales by category.
- A rule that prevents analysts from seeing the
emailcolumn ofcustomers. - A process that joins orders with marketing campaigns and calculates the cost per order won.
- A tool that launches the net sales transformation only when the orders load has finished successfully.
Exercise 2: Tracing an error
Laura notices that the dashboard shows net sales for yesterday that are half the usual amount. Using the reference architecture, list in order the checks you would make, from consumption back to the sources, and state which cross-cutting layer would have prevented the error from reaching users.
Exercise 3: Reading the as-is diagram
Based on the map of DataCorp's current state:
- Which arrows would you remove first, and why?
- Which sources are being wasted today?
- If the person in Marketing who downloads the CSV files goes on vacation for two weeks, what happens? Which component is failing?
Solutions
Exercise 1
- Ingestion (batch, at hourly frequency).
- Governance (official definition and owner). The place where that definition is published for everyone to look up belongs to the metadata layer.
- Monitoring. Since the condition refers to the content of the data, it can also be considered a quality check; the two layers work together.
- Serving and consumption (BI).
- Security and privacy.
- Processing and transformation (it integrates two sources and applies a business rule).
- Orchestration.
Note: it is normal for some items to touch two layers. The classification is an aid to thinking, not a rulebook.
Exercise 2
You walk the flow in reverse:
- Consumption: does the dashboard apply some unexpected filter? Does it read the right table?
- Storage (consumption zone): what value does the daily net sales table hold for yesterday?
- Processing: did the transformation run? Did it finish without errors? Has anyone changed the rule?
- Storage (raw zone): how many of yesterday's orders are in the raw copy?
- Ingestion: did the load finish? Was it interrupted halfway?
- Source: how many of yesterday's orders are in the transactional database? Were there really fewer sales, or was there an incident in the store?
The most likely cause is a transformation that started before ingestion had finished. Orchestration would have prevented it by making one task depend on the other, and monitoring or a quality check (comparing the number of rows with that of a normal day) would have detected it before Laura did.
Exercise 3
- The three that connect the PostgreSQL production database directly to analytical workloads: the one for the nightly scripts and the ones for the two reporting tools. They are what causes the store outages, which is the most serious and visible problem.
- Clickstream, which piles up without anyone analyzing it, and tickets, which are not connected to anything.
- For two weeks no campaign data comes in, and Marketing's reports are left out of date or incomplete. Ingestion is failing, because it is manual and depends on one person; orchestration, which would automate it, and monitoring, which would warn that the data is not arriving, are also missing.
Conclusion
Every data architecture can be described with five stages through which data flows (sources, ingestion, storage, processing, and serving and consumption) and six cross-cutting layers that run across them (governance, metadata, quality, security, orchestration and monitoring). This scheme is the map of the course: each later module goes deeper into one or more of its pieces. Applied to DataCorp, the map of the current state shows the diagnosis clearly: analytical workloads hitting the production database directly, business rules scattered across spreadsheets, two untapped sources and completely empty cross-cutting layers.
We have the map and we know where we are. Before choosing any piece for the future architecture, we need to know precisely what will be demanded of it. In the next lesson we will learn to turn business needs into measurable requirements and to rely on a set of design principles to make, and document, architecture decisions.
