diff --git a/airflow/include/sql/sparte/models/ocsge/intersected/occupation_du_sol_zonage_urbanisme.sql b/airflow/include/sql/sparte/models/ocsge/intersected/occupation_du_sol_zonage_urbanisme.sql index 32639b142..503d0bce5 100644 --- a/airflow/include/sql/sparte/models/ocsge/intersected/occupation_du_sol_zonage_urbanisme.sql +++ b/airflow/include/sql/sparte/models/ocsge/intersected/occupation_du_sol_zonage_urbanisme.sql @@ -1,6 +1,5 @@ {{ config( - materialized='incremental', indexes=[ {'columns': ['departement'], 'type': 'btree'}, {'columns': ['year'], 'type': 'btree'}, @@ -10,23 +9,9 @@ {'columns': ['zonage_gpu_timestamp'], 'type': 'btree'}, {'columns': ['geom'], 'type': 'gist'} ], - pre_hook=[ - "{{ delete_from_this_where_field_not_in('ocsge_loaded_date', 'occupation_du_sol', 'loaded_date') }}", - "{{ delete_from_this_where_field_not_in('zonage_checksum', 'zonage_urbanisme', 'checksum') }}", - ] ) }} -/* - -Cette requête découpe les objets OCS GE d'occupation du sol par zonage d'urbanisme. - -Dans le cas où un objet OCS GE est découpé par plusieurs zonages, il sera dupliqué, mais -la surface totale de l'objet sera conservée. - -*/ - - with max_ocsge_loaded_date as ( SELECT max(ocsge_loaded_date) as ocsge_loaded_date FROM {{ this }} ), max_zonage_gpu_timestamp as ( @@ -58,11 +43,6 @@ with max_ocsge_loaded_date as ( ST_Intersects(zonage.geom, ocsge.geom) AND zonage.srid_source = ocsge.srid_source - - {% if is_incremental() %} - where ocsge.loaded_date > (select ocsge_loaded_date from max_ocsge_loaded_date) - or zonage.gpu_timestamp > (select zonage_gpu_timestamp from max_zonage_gpu_timestamp) - {% endif %} ), occupation_du_sol_zonage_urbanisme_without_surface_with_duplicates_marked as ( SELECT *, @@ -70,7 +50,6 @@ with max_ocsge_loaded_date as ( FROM occupation_du_sol_zonage_urbanisme_without_surface ) - SELECT *, ST_Area(geom) as surface