QGEP / qgepqwat2ili

3 stars 3 forks source link

2023 03 interlis additional models new #108

Closed sjib closed 11 months ago

sjib commented 1 year ago

Crash when trying to click editor 20230325_editor_blocking_crash_qgis

sjib commented 1 year ago

Needs datamodel changes:

sjib commented 1 year ago

Finished check to check if number of subclass entries of organisation are the same as the number of organisations (solves https://github.com/QGEP/qgepqwat2ili/issues/116)

sjib commented 1 year ago

Added orientation selection for INTERLIS labels - should solve https://github.com/QGEP/qgepqwat2ili/issues/114

sjib commented 1 year ago

@ponceta I had to adjust the tests to get the latest datamodels for qwat 1.4.0 and qgep 1.6.0 (and might have to do once more, as we have two more changes pending: https://github.com/QGEP/datamodel/pull/215 https://github.com/QGEP/datamodel/pull/211

Do we want to start a checklist of tasks somewhere what to check if you release a new version? What would be a good place for that?

sjib commented 1 year ago

An error has occurred while executing Python code:

sqlalchemy.exc.IntegrityError: (psycopg2.errors.NotNullViolation) FEHLER: NULL-Wert in Spalte »betreiberref« verletzt Not-Null-Constraint DETAIL: Fehlgeschlagene Zeile enthält (15, null, 1800, unbekannt, null, null, AAA KA56777, null, null, null, null, null, unbekannt, null, unbekannt, null, null, null, null, null, null, null). [SQL: INSERT INTO pg2ili_dss.abwasserbauwerk (t_id, akten, baujahr, baulicherzustand, baulos, bemerkung, bezeichnung, bruttokosten, detailgeometrie, ersatzjahr, finanzierung, inspektionsintervall, sanierungsbedarf, standortname, astatus, subventionen, wbw_basisjahr, wbw_bauart, wiederbeschaffungswert, zugaenglichkeit, betreiberref, eigentuemerref) VALUES (%(t_id)s, %(akten)s, %(baujahr)s, %(baulicherzustand)s, %(baulos)s, %(bemerkung)s, %(bezeichnung)s, %(bruttokosten)s, ST_Force2D(NULL), %(ersatzjahr)s, %(finanzierung)s, %(inspektionsintervall)s, %(sanierungsbedarf)s, %(standortname)s, %(astatus)s, %(subventionen)s, %(wbw_basisjahr)s, %(wbw_bauart)s, %(wiederbeschaffungswert)s, %(zugaenglichkeit)s, %(betreiberref)s, %(eigentuemerref)s)] [parameters: {'t_id': 15, 'akten': None, 'baujahr': 1800, 'baulicherzustand': 'unbekannt', 'baulos': None, 'bemerkung': None, 'bezeichnung': 'AAA KA56777', 'bruttokosten': None, 'ersatzjahr': None, 'finanzierung': None, 'inspektionsintervall': None, 'sanierungsbedarf': 'unbekannt', 'standortname': None, 'astatus': 'unbekannt', 'subventionen': None, 'wbw_basisjahr': None, 'wbw_bauart': None, 'wiederbeschaffungswert': None, 'zugaenglichkeit': None, 'betreiberref': None, 'eigentuemerref': None}] (Background on this error at: https://sqlalche.me/e/14/gkpj) Traceback (most recent call last): File "C:\Users\Stefan\AppData\Roaming\Python\Python39\site-packages\sqlalchemy\engine\base.py", line 1900, in _execute_context self.dialect.do_execute( File "C:\Users\Stefan\AppData\Roaming\Python\Python39\site-packages\sqlalchemy\engine\default.py", line 736, in do_execute cursor.execute(statement, parameters) psycopg2.errors.NotNullViolation: FEHLER: NULL-Wert in Spalte »betreiberref« verletzt Not-Null-Constraint DETAIL: Fehlgeschlagene Zeile enthält (15, null, 1800, unbekannt, null, null, AAA KA56777, null, null, null, null, null, unbekannt, null, unbekannt, null, null, null, null, null, null, null).

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "C:\Users/Stefan/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\qgepplugin\qgepqwat2ili\qgepqwat2ili\gui__init.py", line 499, in action_do_export qgepdss_export(selection=export_dialog.selected_ids, labels_file=labels_file_path, orientation=eorientation) File "C:\Users/Stefan/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\qgepplugin\qgepqwat2ili\qgepqwat2ili\qgepdss\export.py", line 972, in qgep_export abwasser_session.flush() File "C:\Users\Stefan\AppData\Roaming\Python\Python39\site-packages\sqlalchemy\orm\session.py", line 3386, in flush self._flush(objects) File "C:\Users\Stefan\AppData\Roaming\Python\Python39\site-packages\sqlalchemy\orm\session.py", line 3526, in _flush transaction.rollback(_capture_exception=True) File "C:\Users\Stefan\AppData\Roaming\Python\Python39\site-packages\sqlalchemy\util\langhelpers.py", line 70, in exit_ compat.raise( File "C:\Users\Stefan\AppData\Roaming\Python\Python39\site-packages\sqlalchemy\util\compat.py", line 208, in raise_ raise exception File "C:\Users\Stefan\AppData\Roaming\Python\Python39\site-packages\sqlalchemy\orm\session.py", line 3486, in _flush flush_context.execute() File "C:\Users\Stefan\AppData\Roaming\Python\Python39\site-packages\sqlalchemy\orm\unitofwork.py", line 456, in execute rec.execute(self) File "C:\Users\Stefan\AppData\Roaming\Python\Python39\site-packages\sqlalchemy\orm\unitofwork.py", line 630, in execute util.preloaded.orm_persistence.save_obj( File "C:\Users\Stefan\AppData\Roaming\Python\Python39\site-packages\sqlalchemy\orm\persistence.py", line 245, in save_obj _emit_insert_statements( File "C:\Users\Stefan\AppData\Roaming\Python\Python39\site-packages\sqlalchemy\orm\persistence.py", line 1232, in _emit_insert_statements result = connection._execute_20( File "C:\Users\Stefan\AppData\Roaming\Python\Python39\site-packages\sqlalchemy\engine\base.py", line 1705, in _execute_20 return meth(self, args_10style, kwargs_10style, execution_options) File "C:\Users\Stefan\AppData\Roaming\Python\Python39\site-packages\sqlalchemy\sql\elements.py", line 333, in _execute_on_connection return connection._execute_clauseelement( File "C:\Users\Stefan\AppData\Roaming\Python\Python39\site-packages\sqlalchemy\engine\base.py", line 1572, in _execute_clauseelement ret = self._execute_context( File "C:\Users\Stefan\AppData\Roaming\Python\Python39\site-packages\sqlalchemy\engine\base.py", line 1943, in _execute_context self._handle_dbapi_exception( File "C:\Users\Stefan\AppData\Roaming\Python\Python39\site-packages\sqlalchemy\engine\base.py", line 2124, in _handle_dbapiexception util.raise( File "C:\Users\Stefan\AppData\Roaming\Python\Python39\site-packages\sqlalchemy\util\compat.py", line 208, in raise_ raise exception File "C:\Users\Stefan\AppData\Roaming\Python\Python39\site-packages\sqlalchemy\engine\base.py", line 1900, in _execute_context self.dialect.do_execute( File "C:\Users\Stefan\AppData\Roaming\Python\Python39\site-packages\sqlalchemy\engine\default.py", line 736, in do_execute cursor.execute(statement, parameters) sqlalchemy.exc.IntegrityError: (psycopg2.errors.NotNullViolation) FEHLER: NULL-Wert in Spalte »betreiberref« verletzt Not-Null-Constraint DETAIL: Fehlgeschlagene Zeile enthält (15, null, 1800, unbekannt, null, null, AAA KA56777, null, null, null, null, null, unbekannt, null, unbekannt, null, null, null, null, null, null, null).

[SQL: INSERT INTO pg2ili_dss.abwasserbauwerk (t_id, akten, baujahr, baulicherzustand, baulos, bemerkung, bezeichnung, bruttokosten, detailgeometrie, ersatzjahr, finanzierung, inspektionsintervall, sanierungsbedarf, standortname, astatus, subventionen, wbw_basisjahr, wbw_bauart, wiederbeschaffungswert, zugaenglichkeit, betreiberref, eigentuemerref) VALUES (%(t_id)s, %(akten)s, %(baujahr)s, %(baulicherzustand)s, %(baulos)s, %(bemerkung)s, %(bezeichnung)s, %(bruttokosten)s, ST_Force2D(NULL), %(ersatzjahr)s, %(finanzierung)s, %(inspektionsintervall)s, %(sanierungsbedarf)s, %(standortname)s, %(astatus)s, %(subventionen)s, %(wbw_basisjahr)s, %(wbw_bauart)s, %(wiederbeschaffungswert)s, %(zugaenglichkeit)s, %(betreiberref)s, %(eigentuemerref)s)] [parameters: {'t_id': 15, 'akten': None, 'baujahr': 1800, 'baulicherzustand': 'unbekannt', 'baulos': None, 'bemerkung': None, 'bezeichnung': 'AAA KA56777', 'bruttokosten': None, 'ersatzjahr': None, 'finanzierung': None, 'inspektionsintervall': None, 'sanierungsbedarf': 'unbekannt', 'standortname': None, 'astatus': 'unbekannt', 'subventionen': None, 'wbw_basisjahr': None, 'wbw_bauart': None, 'wiederbeschaffungswert': None, 'zugaenglichkeit': None, 'betreiberref': None, 'eigentuemerref': None}] (Background on this error at: https://sqlalche.me/e/14/gkpj)

sjib commented 1 year ago

I get a new error on the qwat test data:

https://github.com/QGEP/qgepqwat2ili/actions/runs/4701248306/jobs/8337019916?pr=108

ERROR: test_case_b_export_complete_qwat_to_xtf (qgepqwat2ili.tests.test_qwat.TestQGEPUseCases) B. export the whole QWAT model to interlis


Traceback (most recent call last): File "/home/runner/work/qgepqwat2ili/qgepqwat2ili/qgepqwat2ili/tests/test_qwat.py", line 28, in test_case_b_export_complete_qwat_to_xtf main(["qwat", "export", path, "--recreate_schema"]) File "/home/runner/work/qgepqwat2ili/qgepqwat2ili/qgepqwat2ili/init.py", line 297, in main qwat_export(include_hydraulics=args.include_hydraulics) File "/home/runner/work/qgepqwat2ili/qgepqwat2ili/qgepqwat2ili/qwat/export.py", line 489, in qwat_export betreiber=row.fk_distributor__REL.name, AttributeError: 'treatment' object has no attribute 'fk_distributor__REL'

Do we need to adapt the testdata in the hotfix file? https://github.com/QGEP/qgepqwat2ili/blob/master/qgepqwat2ili/data/test_data/qwat_demodata_hotfix.sql Or in the matching table export.py? betreiber=row.fk_distributor__REL.name, konzessionaer=DOES_NOT_EXIST_IN_QWAT,

https://github.com/QGEP/qgepqwat2ili/blob/c2d6a88f6ac772f74ee85411f8c3cc8ec080e32c/qgepqwat2ili/qwat/export.py#L489C12-L490C50

What happened to fk_distributor?

Hi Stefan, Fk_distributor is now an inherited array (list) in qwat nodes (taking distributors from every connected pipes) Fk_pressurezone could also create some issues https://github.com/qwat/qwat-data-model/pull/359

We should maybe export only the first value of this array in the export.py script.

LEFT JOIN qwat_od.distributor distributor ON distributor.id = ANY(vw_element_part.fk_distributor) Could be a possible adaptation. I was not aware of this CI. Meilleures Salutations Arnaud

sjib commented 1 year ago

Additional file dialog for import configuration has to be added later: https://github.com/QGEP/qgepqwat2ili/issues/120 Code prepared but unexpected failure when loading new ui file - see https://github.com/QGEP/qgepqwat2ili/pull/108/files#r1275028182

sjib commented 1 year ago

@ponceta https://github.com/QGEP/qgepqwat2ili/pull/131 should solve the problem with the failing qwat tests.

ponceta commented 11 months ago

This has to be merged, it has been mistakely closed.