Warning

🚧 Work in Progress: This page is currently under construction. Content may be incomplete or subject to change. To contribute, see the contribution guide.

DAG Standard β€” Airflow

Mandatory conventions for creating DAGs in Patria’s Airflow.


Naming

{domain}_{subdomain}_{layer}_{action}

Examples:
  investments_fundraising_raw_ingest
  finance_accounts_payable_stage_transform
  corporate_headcount_gold_load

Minimum DAG structure

from airflow import DAG
from airflow.operators.python import PythonOperator
from datetime import datetime, timedelta
 
default_args = {
    'owner': 'data-squad',
    'retries': 2,
    'retry_delay': timedelta(minutes=5),
    'email_on_failure': True,
    'email': ['data@patria.com.br'],
}
 
with DAG(
    dag_id='domain_subdomain_layer_action',
    default_args=default_args,
    description='Clear description of what this DAG does',
    schedule_interval='0 6 * * *',  # Cron expression
    start_date=datetime(2025, 1, 1),
    catchup=False,
    tags=['domain', 'layer'],
) as dag:
    # tasks here
    pass

Mandatory rules

  • Every DAG must have tags with domain and layer
  • email_on_failure: True with the responsible squad’s email
  • catchup: False unless there is a justified reason
  • Document in the DAG catalog after creation
  • Never use hardcoded credentials β€” use Airflow Connections or Secret Manager