A robust, automated data pipeline that extracts real-time weather data from the Open-Meteo API, transforms it into a structured format, and loads it into a PostgreSQL database using Apache Airflow for orchestration.
- Real-time Data Extraction: Fetches current weather data from Open-Meteo API
- Automated Processing: Transforms raw API data into structured format
- Persistent Storage: Stores processed data in PostgreSQL database
- Workflow Orchestration: Uses Apache Airflow for scheduling and monitoring
- Containerized Environment: Docker-based setup for consistent deployment
- Cloud-Ready: Easy transition to AWS RDS for production deployment
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
β Open-Meteo βββββΆβ Apache Airflow βββββΆβ PostgreSQL β
β API β β (Orchestrator) β β Database β
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
Extract Transform Load
- Apache Airflow: Workflow orchestration and scheduling
- Astro CLI: Airflow development and management
- Docker: Containerization platform
- PostgreSQL: Relational database for data storage
- Python: Pipeline logic and data processing
- AWS RDS: Production database deployment (optional)
Before setting up the project, ensure you have the following installed:
- Docker Desktop
- Visual Studio Code (recommended)
- DBeaver (recommended for database management)
- AWS Account (for production deployment)
macOS & Linux:
/bin/bash -c "$(curl -sSL https://install.astronomer.io)"Windows (PowerShell as Administrator):
Invoke-WebRequest -Uri "https://install.astronomer.io" -OutFile "install.ps1"; .\install.ps1git clone https://github.com/yourusername/etl-weather-pipeline.git
cd etl-weather-pipelineastro dev startThis command will:
- Build Docker images
- Start Airflow components (webserver, scheduler, triggerer)
- Start PostgreSQL database
- Make Airflow UI available at
http://localhost:8081
Default Credentials:
- Username:
admin - Password:
admin
Navigate to Admin β Connections in the Airflow UI and create:
PostgreSQL Connection:
- Connection Id:
postgres_default - Connection Type:
Postgres - Host:
postgres_db - Schema:
postgres - Login:
postgres - Password:
postgres - Port:
5432
API Connection:
- Connection Id:
open_meteo_api - Connection Type:
HTTP - Host:
https://api.open-meteo.com
- Navigate to the DAGs page in Airflow UI
- Find
weather_etl_pipeline - Un-pause the DAG using the toggle switch
- Click "Trigger DAG" to run manually
The pipeline creates a weather_data table with the following structure:
| Column | Type | Description |
|---|---|---|
| latitude | FLOAT | Location latitude |
| longitude | FLOAT | Location longitude |
| temperature | FLOAT | Current temperature (Β°C) |
| windspeed | FLOAT | Wind speed (km/h) |
| winddirection | FLOAT | Wind direction (degrees) |
| weathercode | INT | Weather condition code |
| timestamp | TIMESTAMP | Data insertion timestamp |
Connect to PostgreSQL using DBeaver or any SQL client:
Connection Settings:
- Host:
localhost - Port:
5433 - Database:
postgres - Username:
postgres - Password:
postgres
Query to view data:
SELECT * FROM weather_data ORDER BY timestamp DESC;- Navigate to AWS RDS Console
- Create a new PostgreSQL instance
- Note the endpoint URL, username, and password
In the Airflow UI, edit the postgres_default connection:
- Host: Replace
postgres_dbwith your RDS endpoint - Login: Update with RDS master username
- Password: Update with RDS master password
Deploy using:
- Amazon MWAA (Managed Workflows for Apache Airflow)
- EC2/EKS with Astronomer deployment guides
The pipeline uses the following default configuration:
- Target Location: Richardson, Texas (32.7767Β°N, -96.7970Β°W)
- Schedule: Daily execution (
@daily) - Database: PostgreSQL 13
- API: Open-Meteo (free weather API)
To change the location, modify the constants in dags/etl_weather_dag.py:
LATITUDE = '32.7767' # Your latitude
LONGITUDE = '-96.7970' # Your longitudePort Conflicts:
If ports 8081 or 5433 are already in use, modify the port mappings in docker-compose.override.yml
Docker Issues:
- Ensure Docker Desktop is running
- Check Docker daemon status
- For Windows: Enable WSL 2 or Hyper-V
Connection Errors:
- Verify connection configurations in Airflow UI
- Ensure PostgreSQL container is running
- Check network connectivity
View logs for debugging:
astro dev logs- Airflow UI: Monitor DAG runs, task status, and logs
- Database: Query
weather_datatable for data verification - Docker: Use
docker psto check container status
- Make Changes: Modify DAG files in the
dags/directory - Test Locally: Changes are automatically picked up by Airflow
- Verify: Check DAG execution in Airflow UI
- Deploy: Push changes to production environment
- Apache Airflow Documentation
- Astronomer Astro CLI
- Open-Meteo API Documentation
- PostgreSQL Documentation
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project was developed following a comprehensive tutorial from YouTube (https://www.youtube.com/watch?v=Y_vQyMljDsE&t=791s&ab_channel=KrishNaik). Special thanks to the tutorial creator for providing clear guidance on building ETL pipelines with Apache Airflow and modern data engineering practices.
Built with β€οΈ using Apache Airflow and modern data engineering tools