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

add ALL DEFERRED #148

Merged
merged 3 commits into from
Jun 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions qgepqwat2ili/qgep/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@
from geoalchemy2.functions import ST_Force2D, ST_GeomFromGeoJSON
from sqlalchemy import or_
from sqlalchemy.orm import Session
from sqlalchemy.sql import text

from .. import utils
from ..utils.various import logger
from .model_abwasser import get_abwasser_model
from .model_qgep import get_qgep_model


#def qgep_export(selection=None, labels_file=None):
def qgep_export(selection=None, labels_file=None, orientation=None):
"""
Expand All @@ -28,6 +30,9 @@ def qgep_export(selection=None, labels_file=None, orientation=None):
abwasser_session = Session(utils.sqlalchemy.create_engine(), autocommit=False, autoflush=False)
tid_maker = utils.ili2db.TidMaker(id_attribute="obj_id")

# backport from tww https://github.com/teksi/wastewater/blob/3acfba249866d299f8a22e249d9f1e475fe7b88d/plugin/teksi_wastewater/interlis/interlis_model_mapping/interlis_exporter_to_intermediate_schema.py#L83
abwasser_session.execute(text("SET CONSTRAINTS ALL DEFERRED;"))

# Filtering
filtered = selection is not None
subset_ids = selection if selection is not None else []
Expand Down
4 changes: 4 additions & 0 deletions qgepqwat2ili/qgepdss/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from geoalchemy2.functions import ST_Force2D, ST_GeomFromGeoJSON
from sqlalchemy import or_
from sqlalchemy.orm import Session
from sqlalchemy.sql import text

from .. import utils
from ..utils.various import logger
Expand Down Expand Up @@ -32,6 +33,9 @@ def qgep_export(selection=None, labels_file=None, orientation=None):
abwasser_session = Session(utils.sqlalchemy.create_engine(), autocommit=False, autoflush=False)
tid_maker = utils.ili2db.TidMaker(id_attribute="obj_id")

# backport from tww https://github.com/teksi/wastewater/blob/3acfba249866d299f8a22e249d9f1e475fe7b88d/plugin/teksi_wastewater/interlis/interlis_model_mapping/interlis_exporter_to_intermediate_schema.py#L83
abwasser_session.execute(text("SET CONSTRAINTS ALL DEFERRED;"))

# Filtering
filtered = selection is not None
subset_ids = selection if selection is not None else []
Expand Down
4 changes: 4 additions & 0 deletions qgepqwat2ili/qgepsia405/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from geoalchemy2.functions import ST_Force2D, ST_GeomFromGeoJSON
from sqlalchemy import or_
from sqlalchemy.orm import Session
from sqlalchemy.sql import text

from .. import utils
from ..utils.various import logger
Expand All @@ -29,6 +30,9 @@ def qgep_export(selection=None, labels_file=None, orientation=None):
abwasser_session = Session(utils.sqlalchemy.create_engine(), autocommit=False, autoflush=False)
tid_maker = utils.ili2db.TidMaker(id_attribute="obj_id")

# backport from tww https://github.com/teksi/wastewater/blob/3acfba249866d299f8a22e249d9f1e475fe7b88d/plugin/teksi_wastewater/interlis/interlis_model_mapping/interlis_exporter_to_intermediate_schema.py#L83
abwasser_session.execute(text("SET CONSTRAINTS ALL DEFERRED;"))

# Filtering
filtered = selection is not None
subset_ids = selection if selection is not None else []
Expand Down
Loading