résolution des erreurs présente dans la synthese

This commit is contained in:
Colas Geier 2026-07-21 11:33:47 +02:00
parent 4ff41ed91a
commit b3a4f91fe4

View File

@ -127,7 +127,29 @@ def resolve_missing_data(con):
def resolve_synthese_errors(con):
sql = '''
with t1 as (
SELECT
--tro.*,too.*
tro.unique_id_sinp_grp
FROM pr_occtax.t_occurrences_occtax AS too
JOIN pr_occtax.t_releves_occtax tro using (id_releve_occtax)
),t2 as (
select
s.id_synthese,
too.id_releve_occtax,
too.id_occurrence_occtax,
too.id_nomenclature_exist_proof
FROM pr_occtax.t_occurrences_occtax AS too
JOIN pr_occtax.t_releves_occtax tro using (id_releve_occtax)
JOIN pr_occtax.cor_counting_occtax cco using (id_occurrence_occtax)
JOIN gn_synthese.synthese s on s.unique_id_sinp = cco.unique_id_sinp_occtax
WHERE tro.unique_id_sinp_grp IN (SELECT t1.unique_id_sinp_grp FROM t1)
AND (too.nom_cite != s.nom_cite)
)
UPDATE pr_occtax.t_occurrences_occtax too
SET id_nomenclature_exist_proof = t2.id_nomenclature_exist_proof
FROM t2
WHERE too.id_occurrence_occtax = t2.id_occurrence_occtax;
'''
if __name__ == '__main__':