What it is: A classic star schema warehouse built around a central flight facts table, supporting operational reporting on delays, cancellations, and on-time performance across airlines, airports, and time periods.
Real-world use: The operational core of any airline analytics team. Every OTP report, delay attribution analysis, and schedule adherence dashboard reads from a warehouse structured exactly like this.
fact_flights
flight_key, dep_airport_key, arr_airport_key,
airline_key, date_key, aircraft_key,
scheduled_duration_mins, actual_duration_mins,
delay_mins, passengers, status,
delay_category, responsible_party
dim_airports
airport_key, iata_code, airport_name,
city, country, continent, timezone,
airport_type, hub_flag
dim_airlines
airline_key, iata_code, airline_name,
country_of_origin, alliance, airline_type
dim_date
date_key, full_date, year, quarter,
month, month_name, week, day_of_week,
day_name, is_weekend, is_public_holiday,
season, iata_season
dim_aircraft
aircraft_key, aircraft_type, manufacturer,
family, range_km, typical_seats,
engine_count, engine_type, generation
Key reports supported
- Monthly OTP by airline and alliance
- Delay minutes by responsible party and category
- Busiest routes by passenger volume
- Airport hub performance scorecard
- Year-over-year flight volume trends
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β FLIGHT OPERATIONS STAR SCHEMA β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββ
β dim_date β
ββββββββββββββββββββ€
β date_key (PK) β
β full_date β
β year β
β quarter β
β month β
β month_name β
β week β
β day_of_week β
β day_name β
β is_weekend β
β is_public_holidayβ
β season β
β iata_season β
ββββββββββ¬ββββββββββ
β
β 1 : M
β
ββββββββββββββββββββββββββΌβββββββββββββββββββββββββ
β β β
βΌ βΌ βΌ
ββββββββββββββββββββββββ ββββββββββββββββββββββββββββ ββββββββββββββββββββββββ
β dim_airports (Dep) β β fact_flights β β dim_airports (Arr) β
ββββββββββββββββββββββββ€ ββββββββββββββββββββββββββββ€ ββββββββββββββββββββββββ€
β airport_key (PK) β β flight_key (PK) β β airport_key (PK) β
β iata_code β β dep_airport_key (FK)ββββββΌββββΌββ β
β airport_name β β arr_airport_key (FK)ββββββΌββββΌββ β
β city β β airline_key (FK) β β iata_code β
β country β β date_key (FK) β β airport_name β
β continent β β aircraft_key (FK) β β city β
β timezone β β scheduled_duration_mins β β country β
β airport_type β β actual_duration_mins β β continent β
β hub_flag β β delay_mins β β timezone β
ββββββββββββ¬ββββββββββββ β passengers β β airport_type β
β β status β β hub_flag β
β β delay_category β ββββββββββββββββββββββββ
β β responsible_party β
β ββββββββββββ¬ββββββββββββββββ
β β
β 1 : M β 1 : M
β β
βΌ βΌ
ββββββββββββββββββββββββ ββββββββββββββββββββββββ
β dim_airlines β β dim_aircraft β
ββββββββββββββββββββββββ€ ββββββββββββββββββββββββ€
β airline_key (PK) β β aircraft_key (PK) β
β iata_code β β aircraft_type β
β airline_name β β manufacturer β
β country_of_origin β β family β
β alliance β β range_km β
β airline_type β β typical_seats β
ββββββββββββββββββββββββ β engine_count β
β engine_type β
β generation β
ββββββββββββββββββββββββ
Legend:
(PK) = Primary Key
(FK) = Foreign Key
1 : M = One-to-Many Relationship
βββββββββββββββββββββββββββββββββββββββββββββββββββ
β FACT FLIGHTS TABLE β
β (Central Hub) β
βββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βββββββββββββββββββ¬ββββββββββββΌββββββββββββ¬ββββββββββββββββββ
β β β β β
βΌ βΌ βΌ βΌ βΌ
βββββββββββββββ βββββββββββββββ βββββββββββ βββββββββββ βββββββββββββββ
β Airlines β β Origin β β Date β βAircraftβ βDestination β
β Dim β β Airport β β Dim β β Dim β β Airport β
β β β Dim β β β β β β Dim β
βββββββββββββββ βββββββββββββββ βββββββββββ βββββββββββ βββββββββββββββ
β β β β β
β β β β β
βΌ βΌ βΌ βΌ βΌ
[1:M] [1:M] [1:M] [1:M] [1:M]
Each airline Each origin Each date Each aircraft Each dest
has many flights airport has has many has many airport has
many flights flights flights many flights
-- Relationship Summary Table
βββββββββββββββββββ¬βββββββββββββββββββ¬ββββββββββββββββββ¬βββββββββββββββββββββββββββ
β Parent Table β Foreign Key in β Relationship β Business Rule β
β β fact_flights β Type β β
βββββββββββββββββββΌβββββββββββββββββββΌββββββββββββββββββΌβββββββββββββββββββββββββββ€
β dim_airlines β airline_key β One-to-Many β One airline can operate β
β β β β multiple flights β
βββββββββββββββββββΌβββββββββββββββββββΌββββββββββββββββββΌβββββββββββββββββββββββββββ€
β dim_airports β dep_airport_key β One-to-Many β One airport can be the β
β (as origin) β β β origin for many flights β
βββββββββββββββββββΌβββββββββββββββββββΌββββββββββββββββββΌβββββββββββββββββββββββββββ€
β dim_airports β arr_airport_key β One-to-Many β One airport can be the β
β (as dest) β β β destination for many β
β β β β flights β
βββββββββββββββββββΌβββββββββββββββββββΌββββββββββββββββββΌβββββββββββββββββββββββββββ€
β dim_date β date_key β One-to-Many β One date can have many β
β β β β flights β
βββββββββββββββββββΌβββββββββββββββββββΌββββββββββββββββββΌβββββββββββββββββββββββββββ€
β dim_aircraft β aircraft_key β One-to-Many β One aircraft can operate β
β β β β many flights over time β
βββββββββββββββββββ΄βββββββββββββββββββ΄ββββββββββββββββββ΄βββββββββββββββββββββββββββerDiagram
dim_airlines {
int airline_key PK
varchar iata_code
varchar airline_name
varchar country_of_origin
varchar alliance
varchar airline_type
}
dim_airports {
int airport_key PK
varchar iata_code
varchar airport_name
varchar city
varchar country
varchar continent
varchar timezone
varchar airport_type
varchar hub_flag
}
dim_date {
int date_key PK
date full_date
int year
int quarter
int month
varchar month_name
int week
int day_of_week
varchar day_name
boolean is_weekend
boolean is_public_holiday
varchar season
varchar iata_season
}
dim_aircraft {
int aircraft_key PK
varchar aircraft_type
varchar manufacturer
varchar family
int range_km
int typical_seats
int engine_count
varchar engine_type
varchar generation
}
fact_flights {
bigint flight_key PK
int dep_airport_key FK
int arr_airport_key FK
int airline_key FK
int date_key FK
int aircraft_key FK
int scheduled_duration_mins
int actual_duration_mins
int delay_mins
int passengers
varchar status
varchar delay_category
varchar responsible_party
}
%% Relationships
dim_airlines ||--o{ fact_flights : "operates"
dim_airports ||--o{ fact_flights : "origin"
dim_airports ||--o{ fact_flights : "destination"
dim_date ||--o{ fact_flights : "scheduled"
dim_aircraft ||--o{ fact_flights : "assigned"
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β DATA FLOW DIAGRAM β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Source Systems βββββββΊ ETL Process βββββββΊ Data Warehouse βββββββΊ Reports
β β β β
β β β β
βΌ βΌ βΌ βΌ
βββββββββββ ββββββββββββ ββββββββββββ ββββββββββββ
βOps DB β β Extract β β Star β β Monthly β
βFlight ββββββββββββΊβ βββββββββββΊβ Schema βββββββββΊβ OTP β
βData β βTransform β β β β Report β
βββββββββββ βLoad (ETL)β ββββββββββββ ββββββββββββ
ββββββββββββ β β
β β
βΌ βΌ
ββββββββββββ ββββββββββββ
β PowerBI β β Delay β
β DashboardβββββββββΊβ Analysis β
ββββββββββββ ββββββββββββ
Letβs start what we will do:
- First, I will do my research to understand how airline companies work and what are the main business processes we are interested in analyzing.
- Then, I will gather some of the questions that we need our model to answer.
- Then we will dive into the modeling process, defining the dimensions, facts, measurements, granularity, sparsity, and summarizability issues for our model.
- Next step will be designing the schema for our model.
- Then I will collect some data to populate into the data warehouse.
- Next step, I will integrate the data into the database (SQL SERVER Database).
- Before diving into the analysis, I will spend some time talking about indexes.
- The last step is what we are doing all those steps for, which is analyzing the data warehouse and getting interesting insights to help the Management Team make data-driven decisions.
In the project files you will see some files:
- Project Documentations.pdf: The project's documentations.
- DWH Schema.png: The schema for our data warehouse model.
- DWH Tables.xlsx: The dimensions / facts / indexes of the data warehouse.
- DWH Creation.SQL: The SQL Scripts for creating the data warehouse tables.
- Schema.pdf: The schema for our data warehouse generated from SQL SERVER.
- Tables' Populations: The SQL Scripts to poulate the data into the tables.
- DWHProjAirlineCom.bak: Backup of the data warehouse, you can restore it using SQL Server Management Studio.
- Insights.SQL: The SQL Queries used to gain insights and answer questions from the data warehouse.
- Rozek Aviation warehouse
- AehabV Airline Data Warehouse
- Data With Baraa SQL Data Warehouse Project
- Al-ghaly Airline Comapny Data Warehouse
- Open Flights data Source
- Bureau of transportation statistics Postgresql Data Type Formatting Functions PostgreSQL NULLIF Function
# Save the script as init_postgresql.sql
# Then run:
psql -U postgres -f init_postgresql_database.sql
# Or with specific database user
psql -U your_username -d postgres -f init_postgresql_database.sqlpsql -U postgres -d flight_ops_data_warehouse -f ddl_bronze.sql\copy bronze.csv_fact_flights (
dep_airport_key,
arr_airport_key,
airline_key,
date_key,
aircraft_key,
scheduled_duration_mins,
passengers,
actual_duration_mins,
delay_mins,
status,
delay_category,
responsible_party
)
FROM '/home/outis/TechBoy/Flight_Operations_Data_Warehouse/datasets/facts_flights.csv'
CSV HEADER;# Allow postgres user to traverse your directory
chmod o+x /home/outis
chmod o+x /home/outis/TechBoy
chmod o+x /home/outis/TechBoy/Flight_Operations_Data_Warehouse
chmod o+x /home/outis/TechBoy/Flight_Operations_Data_Warehouse/datasets
# Allow postgres to read the CSV files
chmod o+r /home/outis/TechBoy/Flight_Operations_Data_Warehouse/datasets/*.csv