|
| 1 | +"""DAG to anonymize QFDMO acteurs for RGPD""" |
| 2 | + |
| 3 | +from airflow import DAG |
| 4 | +from enrich.config import ( |
| 5 | + COHORTS, |
| 6 | + DBT, |
| 7 | + TASKS, |
| 8 | + EnrichActeursVillesConfig, |
| 9 | +) |
| 10 | +from enrich.tasks.airflow_logic.enrich_config_create_task import ( |
| 11 | + enrich_config_create_task, |
| 12 | +) |
| 13 | +from enrich.tasks.airflow_logic.enrich_dbt_model_suggest_task import ( |
| 14 | + enrich_dbt_model_suggest_task, |
| 15 | +) |
| 16 | +from enrich.tasks.airflow_logic.enrich_dbt_models_refresh_task import ( |
| 17 | + enrich_dbt_models_refresh_task, |
| 18 | +) |
| 19 | +from shared.config import CATCHUPS, SCHEDULES, START_DATES, config_to_airflow_params |
| 20 | + |
| 21 | +with DAG( |
| 22 | + dag_id="enrich_acteurs_villes", |
| 23 | + dag_display_name="🌆 Enrichir - Acteurs Villes", |
| 24 | + default_args={ |
| 25 | + "owner": "airflow", |
| 26 | + "depends_on_past": False, |
| 27 | + "email_on_failure": False, |
| 28 | + "email_on_retry": False, |
| 29 | + "retries": 0, |
| 30 | + }, |
| 31 | + description=("Un DAG pour anonymiser les acteurs vs. RGPD"), |
| 32 | + tags=["annuaire", "entreprises", "ae", "rgpd", "acteurs", "juridique"], |
| 33 | + schedule=SCHEDULES.NONE, |
| 34 | + catchup=CATCHUPS.AWLAYS_FALSE, |
| 35 | + start_date=START_DATES.YESTERDAY, |
| 36 | + params=config_to_airflow_params( |
| 37 | + EnrichActeursVillesConfig( |
| 38 | + dbt_models_refresh=True, |
| 39 | + dbt_models_refresh_command=( |
| 40 | + "dbt build --select tag:marts,tag:enrich,tag:villes" |
| 41 | + ), |
| 42 | + ) |
| 43 | + ), |
| 44 | +) as dag: |
| 45 | + # Instantiation |
| 46 | + config = enrich_config_create_task(dag) |
| 47 | + dbt_refresh = enrich_dbt_models_refresh_task(dag) |
| 48 | + suggest_typo = enrich_dbt_model_suggest_task( |
| 49 | + dag, |
| 50 | + task_id=TASKS.ENRICH_ACTEURS_VILLES_TYPO, |
| 51 | + cohort=COHORTS.ACTEURS_VILLES_TYPO, |
| 52 | + dbt_model_name=DBT.MARTS_ENRICH_ACTEURS_VILLES_TYPO, |
| 53 | + ) |
| 54 | + suggest_new = enrich_dbt_model_suggest_task( |
| 55 | + dag, |
| 56 | + task_id=TASKS.ENRICH_ACTEURS_VILLES_NEW, |
| 57 | + cohort=COHORTS.ACTEURS_VILLES_NEW, |
| 58 | + dbt_model_name=DBT.MARTS_ENRICH_ACTEURS_VILLES_NEW, |
| 59 | + ) |
| 60 | + config >> dbt_refresh # type: ignore |
| 61 | + dbt_refresh >> suggest_typo # type: ignore |
| 62 | + dbt_refresh >> suggest_new # type: ignore |
0 commit comments