Skip to content

Commit

Permalink
feat(epci_ept): remove duplication
Browse files Browse the repository at this point in the history
  • Loading branch information
alexisig committed Nov 14, 2024
1 parent 419772c commit b3735a9
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 56 deletions.
29 changes: 1 addition & 28 deletions airflow/include/sql/sparte/models/admin_express/epci.sql
Original file line number Diff line number Diff line change
Expand Up @@ -8,31 +8,4 @@
{'columns': ['geom'], 'type': 'gist'}
])
}}
with together as (
SELECT
*,
32620 AS srid_source
FROM {{ ref('epci_guadeloupe') }}
UNION ALL
SELECT
*,
32620 AS srid_source
FROM {{ ref('epci_martinique') }}
UNION ALL
SELECT
*,
2972 AS srid_source
FROM {{ ref('epci_guyane') }}
UNION ALL
SELECT
*,
2975 AS srid_source
FROM {{ ref('epci_reunion') }}
UNION ALL
SELECT
*,
2154 AS srid_source
FROM {{ ref('epci_metropole') }}
)
SELECT * FROM together
WHERE is_ept = false
SELECT * FROM {{ ref('epci_tout_type') }} WHERE is_ept = false
38 changes: 38 additions & 0 deletions airflow/include/sql/sparte/models/admin_express/epci_tout_type.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{{
config(
materialized='table',
indexes=[
{'columns': ['id'], 'type': 'btree'},
{'columns': ['code'], 'type': 'btree'},
{'columns': ['name'], 'type': 'btree'},
{'columns': ['geom'], 'type': 'gist'}
])
}}
with together as (
SELECT
*,
32620 AS srid_source
FROM {{ ref('epci_guadeloupe') }}
UNION ALL
SELECT
*,
32620 AS srid_source
FROM {{ ref('epci_martinique') }}
UNION ALL
SELECT
*,
2972 AS srid_source
FROM {{ ref('epci_guyane') }}
UNION ALL
SELECT
*,
2975 AS srid_source
FROM {{ ref('epci_reunion') }}
UNION ALL
SELECT
*,
2154 AS srid_source
FROM {{ ref('epci_metropole') }}
)
SELECT * FROM together
WHERE is_ept = false
29 changes: 1 addition & 28 deletions airflow/include/sql/sparte/models/admin_express/ept.sql
Original file line number Diff line number Diff line change
Expand Up @@ -8,31 +8,4 @@
{'columns': ['geom'], 'type': 'gist'}
])
}}
with together as (
SELECT
*,
32620 AS srid_source
FROM {{ ref('epci_guadeloupe') }}
UNION ALL
SELECT
*,
32620 AS srid_source
FROM {{ ref('epci_martinique') }}
UNION ALL
SELECT
*,
2972 AS srid_source
FROM {{ ref('epci_guyane') }}
UNION ALL
SELECT
*,
2975 AS srid_source
FROM {{ ref('epci_reunion') }}
UNION ALL
SELECT
*,
2154 AS srid_source
FROM {{ ref('epci_metropole') }}
)
SELECT * FROM together
WHERE is_ept = true
SELECT * FROM {{ ref('epci_tout_type') }} WHERE is_ept = true

0 comments on commit b3735a9

Please sign in to comment.