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
2 stars 5 forks source link

Export Selection of reaches and wastewater structures fails #463

Open ponceta opened 1 week ago

ponceta commented 1 week ago

Describe the bug Export Selection of reaches and wastewater structures fails :

image

sqlalchemy.exc.ArgumentError: ON clause, typically a SQL expression or ORM relationship attribute expected, got . 
Traceback (most recent call last):
  File "C:\Users/pulpoar/AppData/Roaming/QGIS/QGIS3\profiles\pulpoar/python/plugins\teksi_wastewater\teksi_wastewater_plugin.py", line 605, in actionExportClicked
    self.interlisImporterExporter.action_export()
  File "C:\Users/pulpoar/AppData/Roaming/QGIS/QGIS3\profiles\pulpoar/python/plugins\teksi_wastewater\interlis\gui\interlis_importer_exporter_gui.py", line 149, in action_export
    raise exception
  File "C:\Users/pulpoar/AppData/Roaming/QGIS/QGIS3\profiles\pulpoar/python/plugins\teksi_wastewater\interlis\gui\interlis_importer_exporter_gui.py", line 119, in action_export
    self.interlis_importer_exporter.interlis_export(
  File "C:\Users/pulpoar/AppData/Roaming/QGIS/QGIS3\profiles\pulpoar/python/plugins\teksi_wastewater\interlis\interlis_importer_exporter.py", line 198, in interlis_export
    self._export_to_intermediate_schema(
  File "C:\Users/pulpoar/AppData/Roaming/QGIS/QGIS3\profiles\pulpoar/python/plugins\teksi_wastewater\interlis\interlis_importer_exporter.py", line 366, in _export_to_intermediate_schema
    twwInterlisExporter.tww_export()
  File "C:\Users/pulpoar/AppData/Roaming/QGIS/QGIS3\profiles\pulpoar/python/plugins\teksi_wastewater\interlis\interlis_model_mapping\interlis_exporter_to_intermediate_schema.py", line 88, in tww_export
    raise exception
  File "C:\Users/pulpoar/AppData/Roaming/QGIS/QGIS3\profiles\pulpoar/python/plugins\teksi_wastewater\interlis\interlis_model_mapping\interlis_exporter_to_intermediate_schema.py", line 83, in tww_export
    self._export()
  File "C:\Users/pulpoar/AppData/Roaming/QGIS/QGIS3\profiles\pulpoar/python/plugins\teksi_wastewater\interlis\interlis_model_mapping\interlis_exporter_to_intermediate_schema.py", line 98, in _export
    self._export_sia405_abwasser()
  File "C:\Users/pulpoar/AppData/Roaming/QGIS/QGIS3\profiles\pulpoar/python/plugins\teksi_wastewater\interlis\interlis_model_mapping\interlis_exporter_to_intermediate_schema.py", line 212, in _export_sia405_abwasser
    self._export_dryweather_downspout()
  File "C:\Users/pulpoar/AppData/Roaming/QGIS/QGIS3\profiles\pulpoar/python/plugins\teksi_wastewater\interlis\interlis_model_mapping\interlis_exporter_to_intermediate_schema.py", line 826, in _export_dryweather_downspout
    query = query.join(
            ^^^^^^^^^^^
  File "", line 2, in join
  File "C:\OSGeo4W\apps\Python312\Lib\site-packages\sqlalchemy\sql\base.py", line 280, in _generative
    x = fn(self, *args, **kw)
        ^^^^^^^^^^^^^^^^^^^^^
  File "", line 2, in join
  File "C:\OSGeo4W\apps\Python312\Lib\site-packages\sqlalchemy\orm\base.py", line 304, in generate
    fn(self, *args, **kw)
  File "C:\OSGeo4W\apps\Python312\Lib\site-packages\sqlalchemy\orm\query.py", line 2429, in join
    onclause_element = coercions.expect(
                       ^^^^^^^^^^^^^^^^^
  File "C:\OSGeo4W\apps\Python312\Lib\site-packages\sqlalchemy\sql\coercions.py", line 396, in expect
    resolved = impl._literal_coercion(
               ^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\OSGeo4W\apps\Python312\Lib\site-packages\sqlalchemy\sql\coercions.py", line 899, in _literal_coercion
    self._raise_for_expected(element)
  File "C:\OSGeo4W\apps\Python312\Lib\site-packages\sqlalchemy\sql\coercions.py", line 518, in _raise_for_expected
    raise exc.ArgumentError(msg, code=code) from err
sqlalchemy.exc.ArgumentError: ON clause, typically a SQL expression or ORM relationship attribute expected, got .

To Reproduce Export Selection to DSS

  1. Select some connected reaches and wastewater structures
  2. Click on export
  3. Click on limit to selection
  4. See error

Expected behavior A selection can be easily exported

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.

sjib commented 1 week ago

Wrong selection criteria _export_dryweather_downspout