Skip to content

Commit

Permalink
fix(dbt)
Browse files Browse the repository at this point in the history
  • Loading branch information
vmttn committed Jun 23, 2023
1 parent 9a07782 commit 73613e2
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion pipeline/dbt/models/intermediate/int__enhanced_structures.sql
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ plausible_personal_emails AS (
SELECT * FROM {{ ref('int__plausible_personal_emails') }}
),

deprecated_sirets AS (
SELECT * FROM {{ ref('int__deprecated_sirets') }}
),

adresses_geocoded AS (
SELECT * FROM {{ ref('int__adresses_geocoded') }}
),
Expand All @@ -17,6 +21,8 @@ siretisation_annotations AS (
final AS (
SELECT
structures.*,
deprecated_sirets.sirene_date_fermeture AS "_di_sirene_date_fermeture",
deprecated_sirets.sirene_etab_successeur AS "_di_sirene_etab_successeur",
adresses_geocoded.longitude AS "longitude",
adresses_geocoded.latitude AS "latitude",
adresses_geocoded.complement_adresse AS "complement_adresse",
Expand All @@ -28,10 +34,12 @@ final AS (
adresses_geocoded.result_citycode AS "_di_geocodage_code_insee",
siretisation_annotations.siret AS "_di_annotated_siret",
siretisation_annotations.antenne AS "_di_annotated_antenne",
COALESCE(plausible_personal_emails._di_surrogate_id IS NOT NULL, FALSE) AS "_di_email_is_pii"
COALESCE(plausible_personal_emails._di_surrogate_id IS NOT NULL, FALSE) AS "_di_email_is_pii",
COALESCE(deprecated_sirets._di_surrogate_id IS NOT NULL, FALSE) AS "_di_has_deprecated_siret"
FROM
structures
LEFT JOIN plausible_personal_emails ON structures._di_surrogate_id = plausible_personal_emails._di_surrogate_id
LEFT JOIN deprecated_sirets ON structures._di_surrogate_id = deprecated_sirets._di_surrogate_id
LEFT JOIN adresses_geocoded ON structures._di_adresse_surrogate_id = adresses_geocoded._di_surrogate_id
LEFT JOIN siretisation_annotations ON structures._di_surrogate_id = siretisation_annotations._di_surrogate_id
)
Expand Down

0 comments on commit 73613e2

Please sign in to comment.