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

2024 11 04 fix ara bauwerk export #178

Draft
wants to merge 155 commits into
base: master
Choose a base branch
from

Conversation

sjib
Copy link
Contributor

@sjib sjib commented Nov 4, 2024

No description provided.

@sjib sjib added the fix label Nov 4, 2024
@sjib sjib self-assigned this Nov 4, 2024
@sjib
Copy link
Contributor Author

sjib commented Nov 4, 2024

Should solve #177

@sjib
Copy link
Contributor Author

sjib commented Nov 4, 2024

Relation to Abwasserbauwerk is now empty with SIA405 Export:

grafik

Abwasserknoten is still exported.
@urskaufmann Is that what you expect?

Maybe in future ARABauwerk should become part of SIA405 Abwasser.
Do we have to implement the same for the other subclasses that are not part of SIA405 Abwasser (Abflusslose_Toilette and KLARA?)
grafik

@sjib
Copy link
Contributor Author

sjib commented Nov 4, 2024

Do we have to implement the same for the other subclasses that are not part of SIA405 Abwasser (Abflusslose_Toilette and KLARA?)

This would only be needed on tww

@sjib
Copy link
Contributor Author

sjib commented Nov 4, 2024

For tww this would have to be extended:

    # select all obj_id from wastewater_structure that are not in wwtp_structure
    cursor.execute(
        "SELECT * FROM qgep_od.wastewater_structure WHERE obj_id NOT IN (SELECT obj_id FROM qgep_od.wwtp_structure);"
    )

@sjib sjib requested a review from urskaufmann November 4, 2024 17:03
@urskaufmann
Copy link

Abwasserknoten is still exported.

I do not expect, that the node is exported. First of all, I expect that there is no error, when I should export such a database to SIA405.
I think, that wastewater_networkelements without relation to a wastewater_structure should be really exceptions. And VSA / SIA should answer these questions and make changes, if necessary.
I think the same problem will/can occur in model 2020 with e.g. Spuelstutzen or other structure parts, if TWW does not handle this problems.

@urskaufmann
Copy link

urskaufmann commented Nov 4, 2024

I have now checked with this new code. And I got the next error (sorry): no more abwassernetzelement, but bauwerksteil:

          File "C:\PROGRA~1\QGIS3\apps\Python312\Lib\site-packages\sqlalchemy\engine\base.py", line 771, in _commit_impl
          self.engine.dialect.do_commit(self.connection)
          File "C:\PROGRA~1\QGIS3\apps\Python312\Lib\site-packages\sqlalchemy\engine\default.py", line 561, in do_commit
          dbapi_connection.commit()
         psycopg2.errors.ForeignKeyViolation: insert or update on table "bauwerksteil" violates foreign key constraint "bauwerksteil_abwasserbauwerkref_fkey"
         DETAIL: Key (abwasserbauwerkref)=(1108) is not present in table "abwasserbauwerk".
         
         
         The above exception was the direct cause of the following exception:
         
         Traceback (most recent call last):
          File "C:\Users/KAU/AppData/Roaming/QGIS/QGIS3\profiles\qgep161_prerealise/python/plugins\qgepplugin\qgepqwat2ili\qgepqwat2ili\gui\__init__.py", line 715, in action_do_export
          qgepsia405_export(
          File "C:\Users/KAU/AppData/Roaming/QGIS/QGIS3\profiles\qgep161_prerealise/python/plugins\qgepplugin\qgepqwat2ili\qgepqwat2ili\qgepsia405\export.py", line 1196, in qgep_export
          abwasser_session.commit()
          File "C:\PROGRA~1\QGIS3\apps\Python312\Lib\site-packages\sqlalchemy\orm\session.py", line 1046, in commit
          self.transaction.commit()
          File "C:\PROGRA~1\QGIS3\apps\Python312\Lib\site-packages\sqlalchemy\orm\session.py", line 508, in commit
          t[1].commit()
          File "C:\PROGRA~1\QGIS3\apps\Python312\Lib\site-packages\sqlalchemy\engine\base.py", line 1762, in commit
          self._do_commit()
          File "C:\PROGRA~1\QGIS3\apps\Python312\Lib\site-packages\sqlalchemy\engine\base.py", line 1793, in _do_commit
          self.connection._commit_impl()
          File "C:\PROGRA~1\QGIS3\apps\Python312\Lib\site-packages\sqlalchemy\engine\base.py", line 773, in _commit_impl
          self._handle_dbapi_exception(e, None, None, None, None)
          File "C:\PROGRA~1\QGIS3\apps\Python312\Lib\site-packages\sqlalchemy\engine\base.py", line 1510, in _handle_dbapi_exception
          util.raise_(
          File "C:\PROGRA~1\QGIS3\apps\Python312\Lib\site-packages\sqlalchemy\util\compat.py", line 182, in raise_
          raise exception
          File "C:\PROGRA~1\QGIS3\apps\Python312\Lib\site-packages\sqlalchemy\engine\base.py", line 771, in _commit_impl
          self.engine.dialect.do_commit(self.connection)
          File "C:\PROGRA~1\QGIS3\apps\Python312\Lib\site-packages\sqlalchemy\engine\default.py", line 561, in do_commit
          dbapi_connection.commit()
         sqlalchemy.exc.IntegrityError: (psycopg2.errors.ForeignKeyViolation) insert or update on table "bauwerksteil" violates foreign key constraint "bauwerksteil_abwasserbauwerkref_fkey"
         DETAIL: Key (abwasserbauwerkref)=(1108) is not present in table "abwasserbauwerk".
         
         (Background on this error at: http://sqlalche.me/e/13/gkpj)

@urskaufmann
Copy link

I did then delete the cover, that was with this ARA-Bauwerk, and then it works....

Copy link

@urskaufmann urskaufmann left a comment

Choose a reason for hiding this comment

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

Does not work, if the ARA-Bauwerk has a structure_part. All Structure_Parts of Wastewater_structures, that are not in the export, can also not be in the export

@sjib
Copy link
Contributor Author

sjib commented Nov 5, 2024 via email

@sjib sjib marked this pull request as draft November 5, 2024 12:18
@sjib
Copy link
Contributor Author

sjib commented Nov 19, 2024

  • check if ws have to be added also in dss export if selection
  • check missing data - comments urs

sjib and others added 21 commits December 10, 2024 14:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants