Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dss export: fix organisation.bemerkung length and allow vl extensions #171

Merged
merged 8 commits into from
Apr 15, 2024

Conversation

cymed
Copy link
Contributor

@cymed cymed commented Feb 22, 2024

@cymed cymed requested a review from sjib February 22, 2024 10:12
cymed and others added 2 commits February 22, 2024 13:16
This PR checks if a relation used in an interlis export has a distinct vsacode. If so, the vsacode is used to find the corresponding value_de in tww_vl.value_list_base. The option to use vsacodes can be turned off on function call.
@cymed cymed changed the title Dss export: fix organisation.bemerkung length Dss export: fix organisation.bemerkung length and allow vl extensions Feb 22, 2024
@@ -445,7 +447,7 @@ def _export_organisation(self):
**self.sia_405_base_common(row, "organisation"),
# --- organisation ---
auid=row.uid,
bemerkung=self.truncate(self.emptystr_to_null(row.remark), 80),
bemerkung=self.truncate(self.emptystr_to_null(row.remark), 255),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As we have now the constraints in the datemodel

ALTER TABLE tww_od.organisation ADD CONSTRAINT og_remark_length_max_255 CHECK(char_length(remark)<=255);

I am not sure if we still need the truncate here. If yes the correction is correct.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

constraints on the datamodel can be disabled. I would keep the truncation

@sjib
Copy link
Contributor

sjib commented Feb 22, 2024

Another exception to length of remark is with abwasserreinigung (also 255 instead of 80):

Copy link
Contributor

@sjib sjib left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check comment on truncate, else it looks good (without having tested if the use_vsa is working - but the option to use vsa code is welcomed.

@cymed
Copy link
Contributor Author

cymed commented Feb 23, 2024

Check comment on truncate, else it looks good (without having tested if the use_vsa is working - but the option to use vsa code is welcomed.

use_vsa was tested using a database with vl extensions

@cymed
Copy link
Contributor Author

cymed commented Feb 26, 2024

Error is:

=================================== FAILURES ===================================
_________________ TestInterlis.test_dss_dataset_import_export __________________
[...]
psycopg2.errors.ForeignKeyViolation: insert or update on table "mechanical_pretreatment" violates foreign key constraint "rel_mechanical_pretreatment_wastewater_structure"
DETAIL:  Key (fk_wastewater_structure)=(ch080qwzVA001062) is not present in table "wastewater_structure"

Where is the script of TestInterlis.test_dss_dataset_import_export? I am not sure that the unit test fails because of the alterations

@cymed cymed closed this Mar 4, 2024
@cymed cymed reopened this Mar 4, 2024
@cymed cymed closed this Apr 15, 2024
@cymed cymed reopened this Apr 15, 2024
@cymed cymed merged commit dcf0590 into teksi:main Apr 15, 2024
9 of 10 checks passed
@cymed cymed deleted the fix_dss_export branch July 18, 2024 13:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants