Closed sjib closed 3 weeks ago
eg. Line 2 and line 8 are the same data
@ponceta Can we ask opengis to code this new create_re_class_entry
?
- unique constraint fk_1 / fk2 to re tables
@cymed
Should we do for tww_od.re_building_group_disposal
CREATE UNIQUE INDEX in_od_organisation_identifier ON tww_od.organisation USING btree (identifier ASC NULLS LAST, fk_dataowner ASC NULL LAST);
this would then be
CREATE UNIQUE INDEX in_re_building_group_disposal_fks ON tww_od.re_building_group_disposal USING btree (fk_building_group ASC NULLS LAST, fk_disposal ASC NULLS LAST);
or
ALTER TABLE tww_od.re_building_group_disposal ADD CONSTRAINT unique_fk_combination UNIQUE (fk_building_group, fk_disposal);
@cymed @ponceta Do you know what is the difference? Pro / Con?
Do we also want to implement the UNIQUE constraint of class organisation?
UNIQUE
!!@comment = "!! Neben UNIQUE OID zusätzlich auch Kombination Bezeichnung, Organisationstyp, UID (Wegleitung GEP-Daten 2020)"
Bezeichnung, Organisationstyp, UID;
END Organisation;
Data in re_tables is ducplicated when re-importing
This should not happen anymore since #414 was merged.
Describe the bug A clear and concise description of what the bug is.
When re-importing the same dataset or another dataset in a existing database with data it does not check if there is already the same data in the re_tables. This leads to duplicates in re_maintenance_event_wastewater_structure and re_building_group_disposal.
To Reproduce Re-import a dataset with re_data a second time and check your re_table in postgres
Expected behavior A clear and concise description of what you expected to happen.
On import it should be checked as with all other tables if there is already a dataset with the same combination fk_1 / fk_2. The function
create_or_update
should be enhanced or an new function should be written that checks on the two fk_* attributes of a n:m re_table instead of the obj_id if there is already the same dataset in there.Screenshots / data If applicable, add screenshots or data to help explain your problem.
Desktop (please complete the following information):
Additional context Add any other context about the problem here.
Tests with
create_re_class_entry
do not work as expected - moved to this new issueSo it does not find the cls
and function call
Originally posted by @sjib in https://github.com/teksi/wastewater/issues/357#issuecomment-2273560604