← All work
Project · Data engineering

Football data warehouse

A modern data warehouse for football data, built from scratch in PostgreSQL — turning raw Transfermarkt data into a clean, modelled data product ready for analysis and machine learning.

PostgreSQLSQLMedallion architectureStar schemaETL
Read the seriesView on GitHub ↗
12raw source tables
3layers: bronze, silver, gold
5gold tables in a star schema
35,962transfers ready for analysis

The problem

Football data is everywhere, but it's messy. The Transfermarkt dataset covers players, games, clubs, competitions, transfers and valuations — spread across a dozen files, with inconsistent names, German labels, impossible formations and duplicated rows.

Querying it directly means complex joins and repeated cleaning every time. I wanted a single source of truth: clean, integrated data that's fast to query for reporting and ready to feed machine learning models.

The architecture

I used a medallion architecture in PostgreSQL, where each layer has one job.

High-level architecture: player, game and competition CSV files flow into bronze, silver and gold layers in PostgreSQL, then out to BI and reporting, ad-hoc SQL queries and machine learning.
From raw CSV files to BI, ad-hoc queries and machine learning.

Bronze

12 raw tables, loaded as-is from the CSV files with a Bash script.

Silver

Cleaned and standardised tables, loaded by a stored procedure.

Gold

A transfers star schema: one fact table and four dimensions.

The result: a transfers star schema

The gold layer models every transfer as an event, connected to the player, both clubs, the date and the type of transfer. A fee_value_ratio measure shows whether a club paid above or below the player's market value.

Star schema: fact_transfer in the centre linked to dim_player, dim_club (for the selling and buying club), dim_date and dim_transfer_type.
The transfers star schema in the gold layer.

Read the series

I've written up the whole build, step by step, so you can follow along and build your own.

Tools

PostgreSQLpgAdmin 4SQL & PL/pgSQLBash & psqldraw.ioGit & GitHubKaggle (Transfermarkt data)

I built this project while following the Building a Modern Data Warehouse – Data Engineering Bootcamp course, applying its methods to football data.

Keep exploring

Want to build something like this?

Data engineering is a core part of the data scientist roadmap. Start with SQL, then build up to projects like this one.