Skip to content

Commit

Permalink
Merge branch 'master' into 2024-08-30-fix2-alchemy
Browse files Browse the repository at this point in the history
  • Loading branch information
sjib committed Aug 30, 2024
2 parents 3b51335 + 7b1e70d commit 984b5d6
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
5 changes: 3 additions & 2 deletions qgepqwat2ili/qgep/import_.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from geoalchemy2.functions import ST_Force3D
from sqlalchemy.orm import Session
from sqlalchemy.orm.attributes import flag_dirty
from sqlalchemy.sql import text

from .. import utils
from ..utils.various import logger
Expand All @@ -27,7 +28,7 @@ def qgep_import(precommit_callback=None):

# We also drop symbology triggers as they badly affect performance. This must be done in a separate session as it
# would deadlock other sessions.
pre_session.execute("SELECT qgep_sys.drop_symbology_triggers();")
pre_session.execute(text("SELECT qgep_sys.drop_symbology_triggers();"))
pre_session.commit()
pre_session.close()

Expand All @@ -39,7 +40,7 @@ def qgep_import(precommit_callback=None):

# 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;")
qgep_session.execute(text("SET CONSTRAINTS ALL DEFERRED;"))

def get_vl_instance(vl_table, value):
"""
Expand Down
5 changes: 3 additions & 2 deletions qgepqwat2ili/qgepdss/import_.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from geoalchemy2.functions import ST_Force3D
from sqlalchemy.orm import Session
from sqlalchemy.orm.attributes import flag_dirty
from sqlalchemy.sql import text

from .. import utils
from ..utils.various import logger
Expand All @@ -30,7 +31,7 @@ def qgep_import(precommit_callback=None):
# We also drop symbology triggers as they badly affect performance. This must be done in a separate session as it
# would deadlock other sessions.
logger.info("drop symbology triggers")
pre_session.execute("SELECT qgep_sys.drop_symbology_triggers();")
pre_session.execute(text("SELECT qgep_sys.drop_symbology_triggers();"))
pre_session.commit()
pre_session.close()

Expand All @@ -44,7 +45,7 @@ def qgep_import(precommit_callback=None):

# 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;")
qgep_session.execute(text("SET CONSTRAINTS ALL DEFERRED;"))



Expand Down
5 changes: 3 additions & 2 deletions qgepqwat2ili/qgepsia405/import_.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from geoalchemy2.functions import ST_Force3D
from sqlalchemy.orm import Session
from sqlalchemy.orm.attributes import flag_dirty
from sqlalchemy.sql import text

from .. import utils
from ..utils.various import logger
Expand All @@ -27,7 +28,7 @@ def qgep_import(precommit_callback=None):

# We also drop symbology triggers as they badly affect performance. This must be done in a separate session as it
# would deadlock other sessions.
pre_session.execute("SELECT qgep_sys.drop_symbology_triggers();")
pre_session.execute(text("SELECT qgep_sys.drop_symbology_triggers();"))
pre_session.commit()
pre_session.close()

Expand All @@ -39,7 +40,7 @@ def qgep_import(precommit_callback=None):

# 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;")
qgep_session.execute(text("SET CONSTRAINTS ALL DEFERRED;"))

def get_vl_instance(vl_table, value):
"""
Expand Down

0 comments on commit 984b5d6

Please sign in to comment.