This project fetches, transforms, and stores IMF economic indicators using Prefect, PostgreSQL, and Metabase. It covers ingestion, transformation with dbt, and dashboarding.
imf-data-pipeline
├── create_table.sql
├── docker-compose.yml
├── ingestion/
│ └── fetch_data.py
├── dbt/
│ └── ... # dbt project
├── flows/
│ └── imf_ingestion_flow.py
├── requirements.txt
└── README.mdgit clone https://github.com/yourusername/imf-pipeline.git
cd imf-pipelinedocker-compose up -dPostgreSQL runs on localhost:5433. Metabase runs at http://localhost:3000.
Create a virtual environment and install Python packages:
python -m venv venv
source venv/bin/activate
pip install -r requirements.txtpython pipeline/imf_pipeline.pyThis will:
- Create tables
- Fetch indicators, countries, regions, and groups
- Fetch and insert time-series economic data
- Run dbt transformations
-
Set up using PostgreSQL with:
- Host: postgres_imf
- Port: 5432
- DB Name: imf_data
- User/Password: xiaolong / xiaolong
-
PostgreSQL data is persisted via Docker volume
postgres_data. -
create_table.sqluses range partitioning for better performance. -
dbt models are located in the
/dbtdirectory.