diff --git a/qgepqwat2ili/qgep/import_.py b/qgepqwat2ili/qgep/import_.py index d4d07965..71963e98 100644 --- a/qgepqwat2ili/qgep/import_.py +++ b/qgepqwat2ili/qgep/import_.py @@ -1092,8 +1092,6 @@ def structure_part_common(row): print(".", end="") logger.info("done") - # Recreate the triggers - # qgep_session.execute('SELECT qgep_sys.create_symbology_triggers();') # Calling the precommit callback if provided, allowing to filter before final import if precommit_callback: @@ -1105,6 +1103,8 @@ def structure_part_common(row): # improve user feedback logger.info("Comitting qgep_session - please be patient ...") qgep_session.commit() + logger.info("qgep_session sucessfully committed") qgep_session.close() + logger.info("qgep_session closed") abwasser_session.close() - + logger.info("abwasser_session closed") diff --git a/qgepqwat2ili/qgepdss/import_.py b/qgepqwat2ili/qgepdss/import_.py index 8b8ffa98..14be4bf8 100644 --- a/qgepqwat2ili/qgepdss/import_.py +++ b/qgepqwat2ili/qgepdss/import_.py @@ -3780,8 +3780,6 @@ def overflow_common(row): logger.info("done") - # Recreate the triggers - # qgep_session.execute('SELECT qgep_sys.create_symbology_triggers();') # Calling the precommit callback if provided, allowing to filter before final import if precommit_callback: @@ -3795,6 +3793,6 @@ def overflow_common(row): qgep_session.commit() logger.info("qgep_session sucessfully committed") qgep_session.close() - + logger.info("qgep_session closed") abwasser_session.close() logger.info("abwasser_session closed") diff --git a/qgepqwat2ili/qgepsia405/import_.py b/qgepqwat2ili/qgepsia405/import_.py index d194cfa7..46900360 100644 --- a/qgepqwat2ili/qgepsia405/import_.py +++ b/qgepqwat2ili/qgepsia405/import_.py @@ -37,7 +37,8 @@ def qgep_import(precommit_callback=None): abwasser_session = Session(utils.sqlalchemy.create_engine(), autocommit=False, autoflush=False) qgep_session = Session(utils.sqlalchemy.create_engine(), autocommit=False, autoflush=False) - # Allow to insert rows with cyclic dependencies at once + # Allow to insert rows with cyclic dependencies at once, needs data modell version 1.6.2 https://github.com/QGEP/datamodel/pull/235 to work properly + logger.info("SET CONSTRAINTS ALL DEFERRED;") qgep_session.execute("SET CONSTRAINTS ALL DEFERRED;") def get_vl_instance(vl_table, value): @@ -1090,28 +1091,19 @@ def structure_part_common(row): # logger.info("done") - # Recreate the triggers - # qgep_session.execute('SELECT qgep_sys.create_symbology_triggers();') # Calling the precommit callback if provided, allowing to filter before final import if precommit_callback: precommit_callback(qgep_session) logger.info("precommit_callback(qgep_session)") - # 11.5.2024 improve user feedback + # improve user feedback logger.info("Comitting qgep_session (precommit_callback) - please be patient ...") else: - # 11.5.2024 improve user feedback + # improve user feedback logger.info("Comitting qgep_session - please be patient ...") qgep_session.commit() + logger.info("qgep_session sucessfully committed") qgep_session.close() + logger.info("qgep_session closed") abwasser_session.close() - -# 31.5.2024 seems to be at wrong place here - needs to be added to gui/gui_import.py - else it is executed too early. - - # TODO : put this in an "finally" block (or context handler) to make sure it's executed - # even if there's an exception - - # post_session = Session(utils.sqlalchemy.create_engine(), autocommit=False, autoflush=False) - # post_session.execute("SELECT qgep_sys.create_symbology_triggers();") - # post_session.commit() - # post_session.close() + logger.info("abwasser_session closed")