Skip to content

Commit

Permalink
chore(pipeline) : Fix trailing spaces in "city" columns
Browse files Browse the repository at this point in the history
A prior investigation showed that for two different sources, we could
find trailing spaces in quite a few lines.

This is now cleaned, but would also be nice to have a test.
  • Loading branch information
vperron committed Jul 25, 2024
1 parent 32c9421 commit eb27546
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ final AS (
data ->> 'nom' AS "nom",
NULLIF(data ->> 'siret', REPEAT('0', 14)) AS "siret",
data ->> 'source' AS "source",
data ->> 'adresse' AS "adresse",
data ->> 'commune' AS "commune",
data ->> 'courriel' AS "courriel",
NULLIF(TRIM(data ->> 'adresse'), '') AS "adresse",
NULLIF(TRIM(data ->> 'commune'), '') AS "commune",
NULLIF(TRIM(data ->> 'courriel'), '') AS "courriel",
data ->> 'site_web' AS "site_web",
data ->> 'telephone' AS "telephone",
NULLIF(TRIM(data ->> 'telephone'), '') AS "telephone",
data ->> 'code_postal' AS "code_postal",
data ->> 'code_insee' AS "code_insee",
data ->> 'horaires_ouverture' AS "horaires_ouverture",
Expand Down
28 changes: 14 additions & 14 deletions pipeline/dbt/models/staging/sources/odspep/stg_odspep__adresses.sql
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,20 @@

final AS (
SELECT
"ID_ADR" AS "id",
"ID_ADR" AS "id_adr",
"L1_IDENTIFICATION_DEST_ADR" AS "l1_identification_dest_adr",
"L2_IDENTITE_DEST_ADR" AS "l2_identite_dest_adr",
"L4_NUMERO_LIB_VOIE_ADR" AS "l4_numero_lib_voie_adr",
"L3_COMPLEMENT_ADR" AS "l3_complement_adr",
"L5_MENTION_ADR" AS "l5_mention_adr",
"L7_PAYS_ADR" AS "l7_pays_adr",
"LATITUDE_ADR"::FLOAT AS "latitude_adr",
"LONGITUDE_ADR"::FLOAT AS "longitude_adr",
"EST_NORMALISEE_ADR"::INT AS "est_normalisee_adr",
"CODE_POSTAL_ADR" AS "code_postal_adr",
"LIBELLE_COMMUNE_ADR" AS "libelle_commune_adr",
NULLIF("CODE_COMMUNE_ADR", 'XXXXX') AS "code_commune_adr"
"ID_ADR" AS "id",
"ID_ADR" AS "id_adr",
"L1_IDENTIFICATION_DEST_ADR" AS "l1_identification_dest_adr",
"L2_IDENTITE_DEST_ADR" AS "l2_identite_dest_adr",
"L4_NUMERO_LIB_VOIE_ADR" AS "l4_numero_lib_voie_adr",
"L3_COMPLEMENT_ADR" AS "l3_complement_adr",
"L5_MENTION_ADR" AS "l5_mention_adr",
"L7_PAYS_ADR" AS "l7_pays_adr",
"LATITUDE_ADR"::FLOAT AS "latitude_adr",
"LONGITUDE_ADR"::FLOAT AS "longitude_adr",
"EST_NORMALISEE_ADR"::INT AS "est_normalisee_adr",
"CODE_POSTAL_ADR" AS "code_postal_adr",
NULLIF(TRIM("LIBELLE_COMMUNE_ADR"), '') AS "libelle_commune_adr",
NULLIF("CODE_COMMUNE_ADR", 'XXXXX') AS "code_commune_adr"
FROM source
)

Expand Down

0 comments on commit eb27546

Please sign in to comment.