humlab-sead / sead_change_control

Sane SEAD change control using Sqitch.
1 stars 0 forks source link

Bugs import assigns NULL value as system id to all ecocode groups. #46

Closed roger-mahler closed 4 years ago

roger-mahler commented 5 years ago

This query should give 0 count as result:

SELECT count(*)
FROM tbl_ecocodes e
JOIN tbl_ecocode_definitions ed USING (ecocode_definition_id)
JOIN tbl_ecocode_groups eg USING (ecocode_group_id)
WHERE ecocode_system_id is null;
ghost commented 5 years ago

Explanation: Bugs has separate sets of tables for ecocodes for its two ecocode systems "Koch Ecology Codes" and "Bugs Ecocodes". The latter is only 2 tables and thus different from SEAD's structure.

Solution: For the Bugs Ecocode system, the import routine needs to inject a connection between tbl_ecocode_systems and tbl_ecocode_groups, and assign group group to the tbl_ecocode_definitions records for this system. This needs to be performed once, and should be valid for all future imports.

Example: This was implemented in an earlier version of the import routine: ecocode_group_id is the injected linking record:

image

image

ghost commented 5 years ago

I miss understood this one. Bugs has no equivalent of ecocode_system_id - they must be created on first import. See earlier system: image

Loer0022 commented 5 years ago

When running the query it provides 0 count, the latest revision of the databse must have solved the underlying issues causing it to hand out values larger than zero

TBL_ISSUE18

roger-mahler commented 5 years ago

Latest Bugs import is on seadserv/sead_staging.

roger-mahler commented 1 year ago

Fixed added to 20191213_BUGS_IMPORT_POST_APPLY