Apache Airflow orchestration layer for the Data-Portfolio ETL and dataset generation pipeline.
This project runs the existing Data-Portfolio export pipeline through Apache Airflow without changing the core ETL logic.
Data-Orchestration
│
│ Airflow DAG
▼
data_portfolio_export
│
│ calls
▼
Data-Portfolio
│
├── SQL Server
├── PostgreSQL
│
▼
Dataset Export
│
├── CSV
├── JSON
└── Parquet
The orchestration layer is responsible for scheduling and executing the existing Data-Portfolio pipeline.
The Data-Portfolio project remains responsible for database access, query execution, transformation, and dataset export.
- Docker Desktop
- Docker Compose
- Data-Portfolio repository
Expected directory structure:
project-root/
├── data-orchestration/
└── data-portfolio/
The data-orchestration project expects the data-portfolio project to be located next to it.
The Data-Portfolio project is mounted into the Airflow container through Docker Compose.
Open PowerShell and navigate to the data-orchestration directory:
cd D:\IMG-DE\data-orchestrationStart the Airflow environment:
docker compose up -dCheck the container status:
docker compose psThe Airflow service should be running.
Airflow Web UI:
http://localhost:8080/
Open the Airflow Web UI:
The default username is:
admin
If the password is not known, retrieve it from the Airflow logs:
docker compose logs airflow | Select-String "password"Use the password displayed in the logs to log in.
Data-Portfolio uses a separate database configuration for the Docker/Airflow environment.
The configuration file is:
data-portfolio/config/db_config.data-portfolio.docker.json
This file contains the database connection settings used when Data-Portfolio runs inside the Airflow container.
For the local Docker environment, the database hosts are:
SQL Server: host.docker.internal:1433
PostgreSQL: host.docker.internal:5432
The Docker-specific configuration also contains the required SQL Server encryption and certificate settings for the local development environment.
The configuration is mounted into the Airflow container together with the Data-Portfolio project.
The main DAG is:
data_portfolio_export
The DAG is responsible for running the Data-Portfolio dataset generation process.
It is configured for manual execution and does not use a scheduled interval.
To run the DAG:
- Open the Airflow Web UI.
- Find
data_portfolio_export. - Open the DAG.
- Click Trigger DAG.
- Monitor the execution from the DAG graph and task logs.
The Data-Portfolio pipeline generates datasets from all configured export jobs.
The dataset builder can be executed from the command line:
python .\powerbi\build_dataset.pyA specific output format can also be provided:
python .\powerbi\build_dataset.py csvSupported output formats:
- CSV
- JSON
- Parquet
When executed through Airflow, the same dataset generation process is triggered by the data_portfolio_export DAG.
Generated datasets are stored in the data directory of the Data-Portfolio project.
Example:
data-portfolio/
└── data/
├── orders_per_year.csv
├── top_actors_by_film_count.csv
└── ...
The generated datasets can be used directly by Power BI or other downstream processes.
Airflow task logs can be viewed directly from the Airflow Web UI.
Local Airflow logs are stored in:
data-orchestration/logs/
To stop the Airflow environment:
docker compose downTo start it again:
docker compose up -dCheck the service status:
docker compose psStart the environment if necessary:
docker compose up -dSQL Server connection timeout
Verify that SQL Server is running and port 1433 is available.
Test connectivity from the Airflow container:
docker compose exec airflow python -c "import socket; print(socket.create_connection(('host.docker.internal',1433),5))"PostgreSQL connection error
Verify that PostgreSQL is running and port 5432 is available.
Test connectivity from the Airflow container:
docker compose exec airflow python -c "import socket; print(socket.create_connection(('host.docker.internal',5432),5))"SQL Server ODBC Driver
Check the installed ODBC drivers:
docker compose exec airflow python -c "import pyodbc; print(pyodbc.drivers())"The output should include:
ODBC Driver 18 for SQL Server
Airflow is used as the orchestration layer, while the Data-Portfolio project remains responsible for the ETL process.
The Data-Portfolio pipeline handles:
- Job configuration
- Database connections
- Query loading
- Data transformation
- Dataset export
- Logging
This separation allows the Data-Portfolio pipeline to run independently from Airflow.
HelloAirflow.py was used during the initial Airflow setup and testing phase.
It is no longer required because the project now uses the data_portfolio_export DAG.
The test file can therefore be removed from the project.