diff --git a/pipeline/dags/dag_utils/sources/__init__.py b/pipeline/dags/dag_utils/sources/__init__.py index f43b90b2..4735464a 100644 --- a/pipeline/dags/dag_utils/sources/__init__.py +++ b/pipeline/dags/dag_utils/sources/__init__.py @@ -55,7 +55,7 @@ "token": Variable.get("MES_AIDES_AIRTABLE_KEY", None), }, "permis_velo": { - "filename": "aides.json", + "filename": "permis_velo.json", "url": Variable.get("MES_AIDES_PERMIS_VELO_URL", None), "token": Variable.get("MES_AIDES_AIRTABLE_KEY", None), }, diff --git a/pipeline/dbt/models/intermediate/sources/mes_aides/permis_velo/int_mes_aides__services_permis_velo.sql b/pipeline/dbt/models/intermediate/sources/mes_aides/permis_velo/int_mes_aides__services_permis_velo.sql index 5e014af0..d4191e5c 100644 --- a/pipeline/dbt/models/intermediate/sources/mes_aides/permis_velo/int_mes_aides__services_permis_velo.sql +++ b/pipeline/dbt/models/intermediate/sources/mes_aides/permis_velo/int_mes_aides__services_permis_velo.sql @@ -12,9 +12,9 @@ zone_code AS ( SELECT permis_velo.id, communes.code, - communes.siren_epci, - communes.departement, - communes.region + communes.code_epci, + communes.code_departement, + communes.code_region FROM permis_velo LEFT JOIN communes ON permis_velo.code_postal = ANY(communes.codes_postaux) AND permis_velo.ville_nom = communes.nom ), @@ -158,9 +158,9 @@ final AS ( transformed_types.transformed_types AS "types", CASE WHEN zone_diffusion.zone_di = 'commune' THEN zone_code.code - WHEN zone_diffusion.zone_di = 'epci' THEN zone_code.siren_epci - WHEN zone_diffusion.zone_di = 'region' THEN zone_code.region - WHEN zone_diffusion.zone_di = 'departement' THEN zone_code.departement + WHEN zone_diffusion.zone_di = 'epci' THEN zone_code.code_epci + WHEN zone_diffusion.zone_di = 'region' THEN zone_code.code_region + WHEN zone_diffusion.zone_di = 'departement' THEN zone_code.code_departement WHEN zone_diffusion.zone_di = 'pays' THEN NULL END AS "zone_diffusion_code", CASE