The scripts in this repo read in the data provided by OpenFlights, normalize it and write it to a Postgres DB. It was created as somewhat interesting sample data for learning some SQL.
Assuming that you have some sort of Postgres server running (this was tested using Postgres 11)
- Create a database
postgres=# CREATE DATABASE openflights;
- run
schema/create.sql
psql <schema/create.sql
- extract the required .dat files from
data/data.tar.gz
or download them yourself fromdata/sources.txt
- place all *.dat files in a folder alongside with
data/planes.csv
- install the python requirements
python3 -m pip install -r etl/requirements.txt
- run
etl/main.py
, look at the options using--help
The initial loading process takes a couple of minutes, depending on your hardware of course.
Alternatively you can also load the SQL dump provided in dump/dump.sql.gz
, which only takes a couple of seconds.