teksi / wastewater

[DEV] Future TEKSI wastewater module, adapted data model to fit VSA-DSS 2020 new standard
https://teksi.github.io/wastewater
GNU General Public License v3.0
1 stars 5 forks source link

Import INTERLIS Fails #285

Closed ponceta closed 2 months ago

ponceta commented 2 months ago

Trying to import https://github.com/teksi/wastewater/blob/main/plugin/teksi_wastewater/tests/data/test-dataset-DSS.xtf

Fails.

Une erreur est survenue lors de l'exécution du code Python : 
AttributeError: tank_emptying_type. Did you mean: 'tank_emptying_kind'? 

FULL ERROR LOG :

2024-07-05T11:06:40     WARNING    Traceback (most recent call last):
              File "C:\OSGeo4W\apps\Python312\Lib\site-packages\sqlalchemy\util\_collections.py", line 214, in __getattr__
              return self._data[key]
              ~~~~~~~~~~^^^^^
             KeyError: 'tank_emptying_type'

             During handling of the above exception, another exception occurred:

             Traceback (most recent call last):
              File "C:\Users/pulpoar/AppData/Roaming/QGIS/QGIS3\profiles\pulpoar/python/plugins\teksi_wastewater\teksi_wastewater_plugin.py", line 491, in actionImportClicked
              self.interlisImporterExporter.action_import()
              File "C:\Users/pulpoar/AppData/Roaming/QGIS/QGIS3\profiles\pulpoar/python/plugins\teksi_wastewater\interlis\gui\interlis_importer_exporter_gui.py", line 79, in action_import
              raise exception
              File "C:\Users/pulpoar/AppData/Roaming/QGIS/QGIS3\profiles\pulpoar/python/plugins\teksi_wastewater\interlis\gui\interlis_importer_exporter_gui.py", line 60, in action_import
              self.interlis_importer_exporter.interlis_import(
              File "C:\Users/pulpoar/AppData/Roaming/QGIS/QGIS3\profiles\pulpoar/python/plugins\teksi_wastewater\interlis\interlis_importer_exporter.py", line 116, in interlis_import
              tww_session = self._import_from_intermediate_schema(import_model)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
              File "C:\Users/pulpoar/AppData/Roaming/QGIS/QGIS3\profiles\pulpoar/python/plugins\teksi_wastewater\interlis\interlis_importer_exporter.py", line 241, in _import_from_intermediate_schema
              interlisImporterToIntermediateSchema.tww_import(skip_closing_tww_session=True)
              File "C:\Users/pulpoar/AppData/Roaming/QGIS/QGIS3\profiles\pulpoar/python/plugins\teksi_wastewater\interlis\interlis_model_mapping\interlis_importer_to_intermediate_schema.py", line 39, in tww_import
              raise exception
              File "C:\Users/pulpoar/AppData/Roaming/QGIS/QGIS3\profiles\pulpoar/python/plugins\teksi_wastewater\interlis\interlis_model_mapping\interlis_importer_to_intermediate_schema.py", line 31, in tww_import
              self._tww_import(skip_closing_tww_session)
              File "C:\Users/pulpoar/AppData/Roaming/QGIS/QGIS3\profiles\pulpoar/python/plugins\teksi_wastewater\interlis\interlis_model_mapping\interlis_importer_to_intermediate_schema.py", line 77, in _tww_import
              self._import_dss()
              File "C:\Users/pulpoar/AppData/Roaming/QGIS/QGIS3\profiles\pulpoar/python/plugins\teksi_wastewater\interlis\interlis_model_mapping\interlis_importer_to_intermediate_schema.py", line 191, in _import_dss
              self._import_beckenentleerung()
              File "C:\Users/pulpoar/AppData/Roaming/QGIS/QGIS3\profiles\pulpoar/python/plugins\teksi_wastewater\interlis\interlis_model_mapping\interlis_importer_to_intermediate_schema.py", line 956, in _import_beckenentleerung
              type=self.get_vl_code(self.model_classes_tww_vl.tank_emptying_type, row.art),
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
              File "C:\OSGeo4W\apps\Python312\Lib\site-packages\sqlalchemy\util\_collections.py", line 216, in __getattr__
              raise AttributeError(key)
             AttributeError: tank_emptying_type. Did you mean: 'tank_emptying_kind'?
ponceta commented 2 months ago

This should be raised by CI Unit tests.

cymed commented 2 months ago

Did you load the latest datamodel? tww_od.tank_emptying.kind was renamed to tww_od.tank_emptying.type in #214, which also adapted the import/export scripts

ponceta commented 2 months ago

Plugin version was not up to date.