-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d82d933
commit c495a91
Showing
5 changed files
with
107 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
version: 2 | ||
|
||
models: | ||
- name: int_cd39__structures | ||
- name: int_cd39__services |
35 changes: 35 additions & 0 deletions
35
pipeline/dbt/models/intermediate/cd39/int_cd39__services.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
WITH structures_services AS ( | ||
SELECT * FROM {{ ref('stg_cd39__structures_services') }} | ||
), | ||
|
||
final AS ( | ||
SELECT | ||
id_service AS "id", | ||
structure_id AS "structure_id", | ||
NULL AS "siret", | ||
NULL::BOOLEAN AS "antenne", | ||
NULL AS "rna", | ||
nom_service AS "nom", | ||
commune AS "commune", | ||
code_postal AS "code_postal", | ||
NULL AS "code_insee", | ||
adresse AS "adresse", | ||
NULL AS "complement_adresse", | ||
NULL AS "longitude", | ||
NULL AS "latitude", | ||
telephone AS "telephone", | ||
courriel_service AS "courriel", | ||
site_web AS "site_web", | ||
_di_source_id AS "source", | ||
NULL AS "lien_source", | ||
NULL AS "horaires_ouverture", | ||
NULL AS "accessibilite", | ||
NULL::TEXT [] AS "labels_nationaux", | ||
NULL::TEXT [] AS "labels_autres", | ||
thematiques::TEXT [] AS "thematiques", | ||
"presentation_detail" AS "presentation_detail", | ||
NULL AS "date_maj" | ||
FROM structures_services | ||
) | ||
|
||
SELECT * FROM final |
36 changes: 36 additions & 0 deletions
36
pipeline/dbt/models/intermediate/cd39/int_cd39__structures.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
WITH structures_services AS ( | ||
SELECT * FROM {{ ref('stg_cd39__structures_services') }} | ||
), | ||
|
||
final AS ( | ||
SELECT | ||
structure_id AS "id", | ||
NULL AS "siret", | ||
NULL::BOOLEAN AS "antenne", | ||
NULL AS "rna", | ||
nom_structure AS "nom", | ||
commune AS "commune", | ||
code_postal AS "code_postal", | ||
NULL AS "code_insee", | ||
adresse AS "adresse", | ||
NULL AS "complement_adresse", | ||
NULL AS "longitude", | ||
NULL AS "latitude", | ||
telephone AS "telephone", | ||
courriel_structure AS "courriel", | ||
site_web AS "site_web", | ||
_di_source_id AS "source", | ||
NULL AS "lien_source", | ||
NULL AS "horaires_ouverture", | ||
NULL AS "accessibilite", | ||
NULL::TEXT [] AS "labels_nationaux", | ||
NULL::TEXT [] AS "labels_autres", | ||
NULL::TEXT [] AS "thematiques", | ||
typologie AS "typologie", | ||
NULL AS "presentation_resume", | ||
NULL AS "presentation_detail", | ||
NULL AS "date_maj" | ||
FROM structures_services | ||
) | ||
|
||
SELECT * FROM final |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
version: 2 | ||
|
||
models: | ||
- name: stg_cd39__structures_services |
27 changes: 27 additions & 0 deletions
27
pipeline/dbt/models/sources/cd39/stg_cd39__structures_services.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
WITH source AS ( | ||
SELECT * FROM {{ source('cd39', 'structures_services') }} | ||
), | ||
|
||
|
||
final AS ( | ||
SELECT | ||
_di_source_id AS "_di_source_id", | ||
data ->> 'structure_id' AS "structure_id", | ||
data ->> 'id_service' AS "id_service", | ||
data ->> 'nom_structure' AS "nom_structure", | ||
data ->> 'typologie' AS "typologie", | ||
data ->> 'courriel_structure' AS "courriel_structure", | ||
data ->> 'code_postal' AS "code_postal", | ||
data ->> 'commune' AS "commune", | ||
data ->> 'adresse' AS "adresse", | ||
data ->> 'profils' AS "profils", | ||
data ->> 'nom_service' AS "nom_service", | ||
data ->> 'presentation_detail' AS "presentation_detail", | ||
data ->> 'thematiques' AS "thematiques", | ||
data ->> 'site_web' AS "site_web", | ||
data ->> 'courriel_service' AS "courriel_service", | ||
data ->> 'telephone' AS "telephone" | ||
FROM source | ||
) | ||
|
||
SELECT * FROM final |