liveBook · Manning

Apache Airflow

As explained in Financial AI in Practice

Apache Airflow is an open-source platform for authoring, scheduling, and monitoring workflows programmatically.

Apache Airflow schedules and orchestrates data workflows. In credit scoring, a monthly workflow can merge usage, bureau, and demographic data into a credit data mart. section 5.1.3

Production financial pipelines may add controls beyond a minimal workflow:

  • Track lineage, resource usage, revisions, and audit activity. section 5.1.3
  • Retry failed data tasks and mark unresolved bureau data as partial coverage. section 5.1.3
  • Coordinate daily or hourly incremental merges with heavier monthly aggregations, and apply encryption and role-based access controls. section 5.1.3
Listing 5.2 A minimal Airflow DAG for BFSI monthly merges
from airflow import DAG
from airflow.providers.postgres.operators.postgres import PostgresOperator
from datetime import datetime

default_args = {
    "owner": "credit_pipeline",
    "start_date": datetime(2024, 1, 1),
    "depends_on_past": False,
    "retries": 1
}

with DAG(
    dag_id="credit_pipeline_dag",
    default_args=default_args,
    schedule="@monthly",    #1
    catchup=False
) as dag:

    monthly_usage = PostgresOperator(
        task_id="create_monthly_usage",
        sql="sql/create_monthly_usage.sql",    #2
        postgres_conn_id="bfsidb"
    )

    bureau_lookup = PostgresOperator(
        task_id="create_bureau_lookup",
        sql="sql/create_bureau_lookup.sql",
        postgres_conn_id="bfsidb"
    )

    demographics = PostgresOperator(
        task_id="create_demographics",
        sql="sql/create_demographics.sql",
        postgres_conn_id="bfsidb"
    )

    credit_data_mart = PostgresOperator(
        task_id="create_credit_data_mart",
        sql="sql/credit_data_mart.sql",     #3
        postgres_conn_id="bfsidb"
    )

monthly_usage >> bureau_lookup >> demographics >> credit_data_mart

A minimal monthly DAG defines PostgreSQL tasks for creating the data sources used in a credit-data merge. section 5.1.3

How Financial AI in Practice covers it

How deep it goes
Defines a minimal monthly DAG and identifies production controls, but stops short of a full production pipeline.
Examples
Merges monthly usage, bureau, and demographic data into a credit data mart and mentions a Kaggle credit-data example.
What you can do after
Apply Airflow to schedule and orchestrate data tasks in a credit-scoring workflow while accounting for production controls.
How it connects
Connects workflow orchestration with batch data pipelines, SQL tasks, lineage, retries, and access controls.

Also explained in

Compare how 5 books explain Apache Airflow →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Financial AI in Practice. The section links point to the parts of the book it draws on.