From 3523c94ef3de5d48b78c4a28a9ab55bde0c92f3d Mon Sep 17 00:00:00 2001 From: Victor Perron Date: Wed, 17 Jul 2024 18:00:01 +0200 Subject: [PATCH] chore(pipeline) : Fix naming inconsistency france-travail was the only source to have an intermediate table name in "agences" instead of "structures". At this stage it should be normalized. --- .../intermediate/int__union_structures.sql | 4 +-- .../france_travail/_france_travail_models.yml | 4 +-- .../int_france_travail__services.sql | 2 +- ...sql => int_france_travail__structures.sql} | 0 .../stg_france_travail__agences.sql | 28 +++++++++---------- 5 files changed, 19 insertions(+), 19 deletions(-) rename pipeline/dbt/models/intermediate/sources/france_travail/{int_france_travail__agences.sql => int_france_travail__structures.sql} (100%) diff --git a/pipeline/dbt/models/intermediate/int__union_structures.sql b/pipeline/dbt/models/intermediate/int__union_structures.sql index 0f7a63bd..d5872d8b 100644 --- a/pipeline/dbt/models/intermediate/int__union_structures.sql +++ b/pipeline/dbt/models/intermediate/int__union_structures.sql @@ -1,5 +1,5 @@ WITH structures AS ( - {{ + {{ dbt_utils.union_relations( relations=[ ref('int_action_logement__structures'), @@ -10,7 +10,7 @@ WITH structures AS ( ref('int_cd72__structures'), ref('int_emplois_de_linclusion__structures'), ref('int_finess__structures'), - ref('int_france_travail__agences'), + ref('int_france_travail__structures'), ref('int_mediation_numerique__structures'), ref('int_mes_aides__structures'), ref('int_monenfant__structures'), diff --git a/pipeline/dbt/models/intermediate/sources/france_travail/_france_travail_models.yml b/pipeline/dbt/models/intermediate/sources/france_travail/_france_travail_models.yml index 37d26b87..a844ca2e 100644 --- a/pipeline/dbt/models/intermediate/sources/france_travail/_france_travail_models.yml +++ b/pipeline/dbt/models/intermediate/sources/france_travail/_france_travail_models.yml @@ -28,7 +28,7 @@ models: tests: - not_null - relationships: - to: ref('int_france_travail__agences') + to: ref('int_france_travail__structures') field: id - name: adresse_id tests: @@ -37,7 +37,7 @@ models: to: ref('int_france_travail__adresses') field: id - - name: int_france_travail__agences + - name: int_france_travail__structures tests: - check_structure: config: diff --git a/pipeline/dbt/models/intermediate/sources/france_travail/int_france_travail__services.sql b/pipeline/dbt/models/intermediate/sources/france_travail/int_france_travail__services.sql index 5bef02ad..dc9ea2e7 100644 --- a/pipeline/dbt/models/intermediate/sources/france_travail/int_france_travail__services.sql +++ b/pipeline/dbt/models/intermediate/sources/france_travail/int_france_travail__services.sql @@ -3,7 +3,7 @@ WITH services AS ( ), agences AS ( - SELECT * FROM {{ ref('int_france_travail__agences') }} + SELECT * FROM {{ ref('int_france_travail__structures') }} ), adresses AS ( diff --git a/pipeline/dbt/models/intermediate/sources/france_travail/int_france_travail__agences.sql b/pipeline/dbt/models/intermediate/sources/france_travail/int_france_travail__structures.sql similarity index 100% rename from pipeline/dbt/models/intermediate/sources/france_travail/int_france_travail__agences.sql rename to pipeline/dbt/models/intermediate/sources/france_travail/int_france_travail__structures.sql diff --git a/pipeline/dbt/models/staging/sources/france_travail/stg_france_travail__agences.sql b/pipeline/dbt/models/staging/sources/france_travail/stg_france_travail__agences.sql index 0125531d..5044b49b 100644 --- a/pipeline/dbt/models/staging/sources/france_travail/stg_france_travail__agences.sql +++ b/pipeline/dbt/models/staging/sources/france_travail/stg_france_travail__agences.sql @@ -4,21 +4,21 @@ WITH source AS ( final AS ( SELECT - _di_source_id AS "_di_source_id", - CURRENT_DATE AS "date_maj", + _di_source_id AS "_di_source_id", + CURRENT_DATE AS "date_maj", CASE WHEN data ->> 'dispositifADEDA' = 'true' THEN 'https://www.francetravail.fr/actualites/a-laffiche/2022/adeda-un-dispositif-pour-mieux-a.html' END AS "accessibilite", - CAST(data #>> '{adressePrincipale,gpsLat}' AS FLOAT) AS "latitude", - CAST(data #>> '{adressePrincipale,gpsLon}' AS FLOAT) AS "longitude", - data #>> '{adressePrincipale,ligne4}' AS "adresse", - data #>> '{adressePrincipale,ligne3}' AS "complement_adresse", - data #>> '{adressePrincipale,communeImplantation}' AS "code_insee", - data #>> '{adressePrincipale,bureauDistributeur}' AS "code_postal", - data #>> '{contact,email}' AS "courriel", - data #>> '{contact,telephonePublic}' AS "telephone", - data ->> 'code' AS "id", - data ->> 'libelleEtendu' AS "nom", - data ->> 'siret' AS "siret", - data ->> 'type' AS "typologie" + CAST(data #>> '{adressePrincipale,gpsLat}' AS FLOAT) AS "latitude", + CAST(data #>> '{adressePrincipale,gpsLon}' AS FLOAT) AS "longitude", + data #>> '{adressePrincipale,ligne4}' AS "adresse", + data #>> '{adressePrincipale,ligne3}' AS "complement_adresse", + data #>> '{adressePrincipale,communeImplantation}' AS "code_insee", + data #>> '{adressePrincipale,bureauDistributeur}' AS "code_postal", + data #>> '{contact,email}' AS "courriel", + data #>> '{contact,telephonePublic}' AS "telephone", + data ->> 'code' AS "id", + data ->> 'libelleEtendu' AS "nom", + data ->> 'siret' AS "siret", + data ->> 'type' AS "typologie" FROM source )