diff --git a/qgepqwat2ili/__init__.py b/qgepqwat2ili/__init__.py index d320d89f..4e533d76 100644 --- a/qgepqwat2ili/__init__.py +++ b/qgepqwat2ili/__init__.py @@ -3,15 +3,15 @@ from logging import INFO, FileHandler, Formatter from . import config, utils -from .qgep.export import qgep_export -from .qgep.import_ import qgep_import +from .qgep.export import qgep_export_kek +from .qgep.import_ import qgep_import_kek from .qgep.mapping import get_qgep_mapping from .qgep.model_abwasser import Base as BaseAbwasser from .qgep.model_qgep import Base as BaseQgep -from .qgepdss.export import qgep_export as qgepdss_export -from .qgepdss.import_ import qgep_import as qgepdss_import -from .qgepsia405.export import qgep_export as qgepsia405_export -from .qgepsia405.import_ import qgep_import as qgepsia405_import +from .qgepdss.export import qgep_export_dss +from .qgepdss.import_ import qgep_import_dss +from .qgepsia405.export import qgep_export_sia405 +from .qgepsia405.import_ import qgep_import_sia405 from .qwat.export import qwat_export from .qwat.import_ import qwat_import from .qwat.mapping import get_qwat_mapping @@ -211,25 +211,21 @@ def main(args): # add model dependency if args.export_sia405: # SIA405_ABWASSER_2015_LV95 - qgepsia405_export( + qgep_export_sia405( selection=args.selection.split(",") if args.selection else None, labels_file=args.labels_file, orientation=args.labels_orientation, ) elif args.export_dss: # DSS_2015_LV95 expor5t - qgepdss_export( + qgep_export_dss( selection=args.selection.split(",") if args.selection else None, labels_file=args.labels_file, orientation=args.labels_orientation, ) else: # VSA_KEK_2019_LV95 export - - # qgep_export(selection=args.selection.split(",") if args.selection else None, labels_file=args.labels_file) - # 4.4.2023 with labels_orientation - # qgep_export(selection=args.selection.split(",") if args.selection else None, labels_file=args.labels_file, orientation=args.labels_orientation if args.labels_orientation else 0) - qgep_export( + qgep_export_kek( selection=args.selection.split(",") if args.selection else None, labels_file=args.labels_file, orientation=args.labels_orientation, @@ -290,8 +286,8 @@ def main(args): utils.ili2db.import_xtf_data( SCHEMA, args.path, make_log_path(log_path, "iliimport") ) - print("qgep_import: " + SCHEMA + "/" + ILI_MODEL) - qgep_import() + print("qgep_import_kek: " + SCHEMA + "/" + ILI_MODEL) + qgep_import_kek() elif impmodel == "SIA405_ABWASSER_2015_LV95": ABWASSER_SIA405_SCHEMA = config.ABWASSER_SIA405_SCHEMA ABWASSER_SIA405_ILI_MODEL = config.ABWASSER_SIA405_ILI_MODEL @@ -311,7 +307,7 @@ def main(args): + "/" + ABWASSER_SIA405_ILI_MODEL ) - qgepsia405_import() + qgep_import_sia405() elif impmodel == "DSS_2015_LV95": ABWASSER_DSS_SCHEMA = config.ABWASSER_DSS_SCHEMA @@ -327,7 +323,7 @@ def main(args): ABWASSER_DSS_SCHEMA, args.path, make_log_path(log_path, "iliimport") ) print("qgepdss_import: " + ABWASSER_DSS_SCHEMA + "/" + ABWASSER_DSS_ILI_MODEL) - qgepdss_import() + qgep_import_dss() else: print( diff --git a/qgepqwat2ili/gui/__init__.py b/qgepqwat2ili/gui/__init__.py index 455f6ecf..6cc9b206 100644 --- a/qgepqwat2ili/gui/__init__.py +++ b/qgepqwat2ili/gui/__init__.py @@ -15,16 +15,16 @@ from ....utils.qgeplayermanager import QgepLayerManager from .. import config -from ..qgep.export import qgep_export -from ..qgep.import_ import qgep_import +from ..qgep.export import qgep_export_kek +from ..qgep.import_ import qgep_import_kek # 12.7.2022 additional models -from ..qgepdss.export import qgep_export as qgepdss_export -from ..qgepdss.import_ import qgep_import as qgepdss_import +from ..qgepdss.export import qgep_export_dss +from ..qgepdss.import_ import qgep_import_dss # 28.3.2023 additional import for sia405, export to be discussed further -from ..qgepsia405.export import qgep_export as qgepsia405_export -from ..qgepsia405.import_ import qgep_import as qgepsia405_import +from ..qgepsia405.export import qgep_export_sia405 +from ..qgepsia405.import_ import qgep_import_sia405 from ..utils.ili2db import ( # neu 22.7.2022; get_xtf_model,; neu 31.3.2023; neu 12.4.2023 check_fk_dataowner_null, check_fk_operator_null, @@ -288,22 +288,18 @@ def action_import(plugin): log_handler.setLevel(logging.INFO) log_handler.setFormatter(logging.Formatter("%(levelname)-8s %(message)s")) with LoggingHandlerContext(log_handler): - # qgep_import( - # precommit_callback=import_dialog.init_with_session, - # ) - progress_dialog.setLabelText("Loading import wizard - please be patient...") # 24.3.2023 added model dependency if imodel == "VSA_KEK_2019_LV95": - qgep_import( + qgep_import_kek( precommit_callback=import_dialog.init_with_session, ) elif imodel == "SIA405_ABWASSER_2015_LV95": - qgepsia405_import( + qgep_import_sia405( precommit_callback=import_dialog.init_with_session, ) elif imodel == "DSS_2015_LV95": - qgepdss_import( + qgep_import_dss( precommit_callback=import_dialog.init_with_session, ) else: @@ -662,10 +658,8 @@ def action_do_export(): logger.info(f"Start Exporting with selection {str(export_dialog.selected_ids)}") if emodel == "VSA_KEK_2019_LV95": - logger.info("Start Exporting VSA_KEK_2019_LV95 - qgep_export") - # qgep_export(selection=export_dialog.selected_ids, labels_file=labels_file_path) - # 3.4.2023 neu mit eorientation - qgep_export( + logger.info("Start Exporting VSA_KEK_2019_LV95") + qgep_export_kek( selection=export_dialog.selected_ids, labels_file=labels_file_path, orientation=eorientation, @@ -675,7 +669,7 @@ def action_do_export(): logger.info("Start Exporting SIA405_ABWASSER_2015_LV95 - qgepsia405_export") # qgepsia405_export(selection=export_dialog.selected_ids, labels_file=labels_file_path) # 3.4.2023 neu mit eorientation - qgepsia405_export( + qgep_export_sia405( selection=export_dialog.selected_ids, labels_file=labels_file_path, orientation=eorientation, @@ -684,7 +678,7 @@ def action_do_export(): logger.info("Start Exporting DSS_2015_LV95 - qgepdss_export") # qgepdss_export(selection=export_dialog.selected_ids, labels_file=labels_file_path) # 3.4.2023 neu mit eorientation - qgepdss_export( + qgep_export_dss( selection=export_dialog.selected_ids, labels_file=labels_file_path, orientation=eorientation, diff --git a/qgepqwat2ili/qgep/export.py b/qgepqwat2ili/qgep/export.py index c884ea34..07087053 100644 --- a/qgepqwat2ili/qgep/export.py +++ b/qgepqwat2ili/qgep/export.py @@ -14,7 +14,7 @@ from .model_qgep import get_qgep_model -def qgep_export(selection=None, labels_file=None, orientation=None, basket_enabled=False): +def qgep_export_kek(selection=None, labels_file=None, orientation=None, basket_enabled=False): """ Export data from the QGEP model into the ili2pg model. @@ -22,8 +22,8 @@ def qgep_export(selection=None, labels_file=None, orientation=None, basket_enabl selection: if provided, limits the export to networkelements that are provided in the selection """ - QGEP = get_qgep_model() - ABWASSER = get_abwasser_model() + qgep_model = get_qgep_model() + abwasser_model = get_abwasser_model() # Logging disabled (very slow) # qgep_session = Session(utils.sqlalchemy.create_engine(logger_name="qgep"), autocommit=False, autoflush=False) @@ -38,7 +38,7 @@ def qgep_export(selection=None, labels_file=None, orientation=None, basket_enabl basket_utils = None current_basket = None if basket_enabled: - basket_utils = BasketUtils(ABWASSER, abwasser_session) + basket_utils = BasketUtils(abwasser_model, abwasser_session) basket_utils.create_basket() current_basket = basket_utils.basket_topic_sia405_abwasser @@ -67,133 +67,29 @@ def qgep_export(selection=None, labels_file=None, orientation=None, basket_enabl tid_maker=tid_maker, current_basket=current_basket, abwasser_session=abwasser_session, - abwasser_model=ABWASSER, + abwasser_model=abwasser_model, + qgep_session=qgep_session, + qgep_model=qgep_model, labelorientation=labelorientation, + filtered=filtered, + subset_ids=subset_ids, ) # ADAPTED FROM 052a_sia405_abwasser_2015_2_d_interlisexport2.sql logger.info("Exporting QGEP.organisation -> ABWASSER.organisation, ABWASSER.metaattribute") - query = qgep_session.query(QGEP.organisation) - for row in query: - - # AVAILABLE FIELDS IN QGEP.organisation - - # --- organisation --- - # fk_dataowner, fk_provider, identifier, last_modification, obj_id, remark, uid - - # --- _bwrel_ --- - # accident__BWREL_fk_dataowner, accident__BWREL_fk_provider, administrative_office__BWREL_obj_id, aquifier__BWREL_fk_dataowner, aquifier__BWREL_fk_provider, bathing_area__BWREL_fk_dataowner, bathing_area__BWREL_fk_provider, canton__BWREL_obj_id, catchment_area__BWREL_fk_dataowner, catchment_area__BWREL_fk_provider, connection_object__BWREL_fk_dataowner, connection_object__BWREL_fk_operator, connection_object__BWREL_fk_owner, connection_object__BWREL_fk_provider, control_center__BWREL_fk_dataowner, control_center__BWREL_fk_provider, cooperative__BWREL_obj_id, damage__BWREL_fk_dataowner, damage__BWREL_fk_provider, data_media__BWREL_fk_dataowner, data_media__BWREL_fk_provider, file__BWREL_fk_dataowner, file__BWREL_fk_provider, fish_pass__BWREL_fk_dataowner, fish_pass__BWREL_fk_provider, hazard_source__BWREL_fk_dataowner, hazard_source__BWREL_fk_owner, hazard_source__BWREL_fk_provider, hq_relation__BWREL_fk_dataowner, hq_relation__BWREL_fk_provider, hydr_geom_relation__BWREL_fk_dataowner, hydr_geom_relation__BWREL_fk_provider, hydr_geometry__BWREL_fk_dataowner, hydr_geometry__BWREL_fk_provider, hydraulic_char_data__BWREL_fk_dataowner, hydraulic_char_data__BWREL_fk_provider, maintenance_event__BWREL_fk_dataowner, maintenance_event__BWREL_fk_operating_company, maintenance_event__BWREL_fk_provider, measurement_result__BWREL_fk_dataowner, measurement_result__BWREL_fk_provider, measurement_series__BWREL_fk_dataowner, measurement_series__BWREL_fk_provider, measuring_device__BWREL_fk_dataowner, measuring_device__BWREL_fk_provider, measuring_point__BWREL_fk_dataowner, measuring_point__BWREL_fk_operator, measuring_point__BWREL_fk_provider, mechanical_pretreatment__BWREL_fk_dataowner, mechanical_pretreatment__BWREL_fk_provider, municipality__BWREL_obj_id, mutation__BWREL_fk_dataowner, mutation__BWREL_fk_provider, organisation__BWREL_fk_dataowner, organisation__BWREL_fk_provider, overflow__BWREL_fk_dataowner, overflow__BWREL_fk_provider, overflow_char__BWREL_fk_dataowner, overflow_char__BWREL_fk_provider, pipe_profile__BWREL_fk_dataowner, pipe_profile__BWREL_fk_provider, private__BWREL_obj_id, profile_geometry__BWREL_fk_dataowner, profile_geometry__BWREL_fk_provider, reach_point__BWREL_fk_dataowner, reach_point__BWREL_fk_provider, retention_body__BWREL_fk_dataowner, retention_body__BWREL_fk_provider, river_bank__BWREL_fk_dataowner, river_bank__BWREL_fk_provider, river_bed__BWREL_fk_dataowner, river_bed__BWREL_fk_provider, sector_water_body__BWREL_fk_dataowner, sector_water_body__BWREL_fk_provider, sludge_treatment__BWREL_fk_dataowner, sludge_treatment__BWREL_fk_provider, structure_part__BWREL_fk_dataowner, structure_part__BWREL_fk_provider, substance__BWREL_fk_dataowner, substance__BWREL_fk_provider, surface_runoff_parameters__BWREL_fk_dataowner, surface_runoff_parameters__BWREL_fk_provider, surface_water_bodies__BWREL_fk_dataowner, surface_water_bodies__BWREL_fk_provider, throttle_shut_off_unit__BWREL_fk_dataowner, throttle_shut_off_unit__BWREL_fk_provider, txt_symbol__BWREL_fk_dataowner, txt_symbol__BWREL_fk_provider, waste_water_association__BWREL_obj_id, waste_water_treatment__BWREL_fk_dataowner, waste_water_treatment__BWREL_fk_provider, waste_water_treatment_plant__BWREL_obj_id, wastewater_networkelement__BWREL_fk_dataowner, wastewater_networkelement__BWREL_fk_provider, wastewater_structure__BWREL_fk_dataowner, wastewater_structure__BWREL_fk_operator, wastewater_structure__BWREL_fk_owner, wastewater_structure__BWREL_fk_provider, wastewater_structure_symbol__BWREL_fk_dataowner, wastewater_structure_symbol__BWREL_fk_provider, water_catchment__BWREL_fk_dataowner, water_catchment__BWREL_fk_provider, water_control_structure__BWREL_fk_dataowner, water_control_structure__BWREL_fk_provider, water_course_segment__BWREL_fk_dataowner, water_course_segment__BWREL_fk_provider, wwtp_energy_use__BWREL_fk_dataowner, wwtp_energy_use__BWREL_fk_provider, zone__BWREL_fk_dataowner, zone__BWREL_fk_provider - - # --- _rel_ --- - # fk_dataowner__REL, fk_provider__REL - - organisation = ABWASSER.organisation( - # FIELDS TO MAP TO ABWASSER.organisation - # --- baseclass --- - # --- sia405_baseclass --- - **qgep_export_utils.base_common(row, "organisation"), - # --- organisation --- - auid=row.uid, - bemerkung=qgep_export_utils.truncate( - qgep_export_utils.emptystr_to_null(row.remark), 80 - ), - bezeichnung=qgep_export_utils.null_to_emptystr(row.identifier), - ) - abwasser_session.add(organisation) - qgep_export_utils.create_metaattributes(row) - print(".", end="") - logger.info("done") - abwasser_session.flush() + qgep_export_utils.export_organisation() logger.info("Exporting QGEP.channel -> ABWASSER.kanal, ABWASSER.metaattribute") - query = qgep_session.query(QGEP.channel) - if filtered: - query = query.join(QGEP.wastewater_networkelement).filter( - QGEP.wastewater_networkelement.obj_id.in_(subset_ids) - ) - for row in query: - # AVAILABLE FIELDS IN QGEP.channel - - # --- wastewater_structure --- - # _bottom_label, _cover_label, _depth, _function_hierarchic, _input_label, _label, _output_label, _usage_current, accessibility, contract_section, detail_geometry_geometry, financing, fk_dataowner, fk_main_cover, fk_main_wastewater_node, fk_operator, fk_owner, fk_provider, gross_costs, identifier, inspection_interval, last_modification, location_name, records, remark, renovation_necessity, replacement_value, rv_base_year, rv_construction_type, status, structure_condition, subsidies, year_of_construction, year_of_replacement - - # --- _bwrel_ --- - # measuring_point__BWREL_fk_wastewater_structure, mechanical_pretreatment__BWREL_fk_wastewater_structure, re_maintenance_event_wastewater_structure__BWREL_fk_wastewater_structure, structure_part__BWREL_fk_wastewater_structure, txt_symbol__BWREL_fk_wastewater_structure, txt_text__BWREL_fk_wastewater_structure, wastewater_networkelement__BWREL_fk_wastewater_structure, wastewater_structure_symbol__BWREL_fk_wastewater_structure, wastewater_structure_text__BWREL_fk_wastewater_structure, wwtp_structure_kind__BWREL_obj_id - - # --- _rel_ --- - # accessibility__REL, bedding_encasement__REL, connection_type__REL, financing__REL, fk_dataowner__REL, fk_main_cover__REL, fk_main_wastewater_node__REL, fk_operator__REL, fk_owner__REL, fk_provider__REL, function_hierarchic__REL, function_hydraulic__REL, renovation_necessity__REL, rv_construction_type__REL, status__REL, structure_condition__REL, usage_current__REL, usage_planned__REL - - kanal = ABWASSER.kanal( - # FIELDS TO MAP TO ABWASSER.kanal - # --- baseclass --- - # --- sia405_baseclass --- - **qgep_export_utils.base_common(row, "kanal"), - # --- abwasserbauwerk --- - **qgep_export_utils.wastewater_structure_common(row), - # --- kanal --- - bettung_umhuellung=qgep_export_utils.get_vl(row.bedding_encasement__REL), - funktionhierarchisch=qgep_export_utils.get_vl(row.function_hierarchic__REL), - funktionhydraulisch=qgep_export_utils.get_vl(row.function_hydraulic__REL), - nutzungsart_geplant=qgep_export_utils.get_vl(row.usage_planned__REL), - nutzungsart_ist=qgep_export_utils.get_vl(row.usage_current__REL), - rohrlaenge=row.pipe_length, - spuelintervall=row.jetting_interval, - verbindungsart=qgep_export_utils.get_vl(row.connection_type__REL), - ) - abwasser_session.add(kanal) - qgep_export_utils.create_metaattributes(row) - print(".", end="") - logger.info("done") - abwasser_session.flush() + qgep_export_utils.export_channel() logger.info("Exporting QGEP.manhole -> ABWASSER.normschacht, ABWASSER.metaattribute") - query = qgep_session.query(QGEP.manhole) - if filtered: - query = query.join(QGEP.wastewater_networkelement).filter( - QGEP.wastewater_networkelement.obj_id.in_(subset_ids) - ) - for row in query: - # AVAILABLE FIELDS IN QGEP.manhole - - # --- wastewater_structure --- - # to do attributeslist of superclass - # --- manhole --- - # to do attributeslist of subclass - # to do extra funktion schreiben wo alle englischen attribute erzeugt werden - - # --- _bwrel_ --- - # to do extra funktion schreiben wo alle fk auf diese superklasse erzeugt werden z.B. # measuring_point__BWREL_fk_wastewater_structure, - - # --- _rel_ --- - # to do extra funktion schreiben wo alle fk auf diese klasse erzeugt werden z.B. # accessibility__REL, bedding_encasement__REL, - - normschacht = ABWASSER.normschacht( - # FIELDS TO MAP TO ABWASSER.normschacht - # --- baseclass --- - # --- sia405_baseclass --- - **qgep_export_utils.base_common(row, "normschacht"), - # --- abwasserbauwerk --- - **qgep_export_utils.wastewater_structure_common(row), - # --- normschacht --- - dimension1=row.dimension1, - dimension2=row.dimension2, - funktion=qgep_export_utils.get_vl(row.function__REL), - # -- attribute 3D --- - # maechtigkeit=row.depth, - material=qgep_export_utils.get_vl(row.material__REL), - oberflaechenzulauf=qgep_export_utils.get_vl(row.surface_inflow__REL), - ) - abwasser_session.add(normschacht) - qgep_export_utils.create_metaattributes(row) - print(".", end="") - logger.info("done") - abwasser_session.flush() + qgep_export_utils.export_manhole() logger.info("Exporting QGEP.discharge_point -> ABWASSER.einleitstelle, ABWASSER.metaattribute") - query = qgep_session.query(QGEP.discharge_point) + query = qgep_session.query(qgep_model.discharge_point) if filtered: - query = query.join(QGEP.wastewater_networkelement).filter( - QGEP.wastewater_networkelement.obj_id.in_(subset_ids) + query = query.join(qgep_model.wastewater_networkelement).filter( + qgep_model.wastewater_networkelement.obj_id.in_(subset_ids) ) for row in query: # AVAILABLE FIELDS IN QGEP.discharge_point @@ -210,7 +106,7 @@ def qgep_export(selection=None, labels_file=None, orientation=None, basket_enabl # --- _rel_ --- # to do extra funktion schreiben wo alle fk auf diese klasse erzeugt werden z.B. # accessibility__REL, bedding_encasement__REL, - einleitstelle = ABWASSER.einleitstelle( + einleitstelle = abwasser_model.einleitstelle( # FIELDS TO MAP TO ABWASSER.einleitstelle # --- baseclass --- # --- sia405_baseclass --- @@ -234,55 +130,15 @@ def qgep_export(selection=None, labels_file=None, orientation=None, basket_enabl logger.info( "Exporting QGEP.special_structure -> ABWASSER.spezialbauwerk, ABWASSER.metaattribute" ) - query = qgep_session.query(QGEP.special_structure) - if filtered: - query = query.join(QGEP.wastewater_networkelement).filter( - QGEP.wastewater_networkelement.obj_id.in_(subset_ids) - ) - for row in query: - # AVAILABLE FIELDS IN QGEP.special_structure - - # --- wastewater_structure --- - # _bottom_label, _cover_label, _depth, _function_hierarchic, _input_label, _label, _output_label, _usage_current, accessibility, contract_section, detail_geometry_geometry, financing, fk_dataowner, fk_main_cover, fk_main_wastewater_node, fk_operator, fk_owner, fk_provider, gross_costs, identifier, inspection_interval, last_modification, location_name, records, remark, renovation_necessity, replacement_value, rv_base_year, rv_construction_type, status, structure_condition, subsidies, year_of_construction, year_of_replacement - - # --- special_structure --- - # bypass, emergency_spillway, function, obj_id, stormwater_tank_arrangement, upper_elevation - - # --- _bwrel_ --- - # measuring_point__BWREL_fk_wastewater_structure, mechanical_pretreatment__BWREL_fk_wastewater_structure, re_maintenance_event_wastewater_structure__BWREL_fk_wastewater_structure, structure_part__BWREL_fk_wastewater_structure, txt_symbol__BWREL_fk_wastewater_structure, txt_text__BWREL_fk_wastewater_structure, wastewater_networkelement__BWREL_fk_wastewater_structure, wastewater_structure_symbol__BWREL_fk_wastewater_structure, wastewater_structure_text__BWREL_fk_wastewater_structure, wwtp_structure_kind__BWREL_obj_id - - # --- _rel_ --- - # accessibility__REL, bypass__REL, emergency_spillway__REL, financing__REL, fk_dataowner__REL, fk_main_cover__REL, fk_main_wastewater_node__REL, fk_operator__REL, fk_owner__REL, fk_provider__REL, function__REL, renovation_necessity__REL, rv_construction_type__REL, status__REL, stormwater_tank_arrangement__REL, structure_condition__REL - - # QGEP field special_structure.upper_elevation is a 3D attribute and has no equivalent in the INTERLIS 2D model release used. It will be ignored for now and not supported with QGEP. - - spezialbauwerk = ABWASSER.spezialbauwerk( - # FIELDS TO MAP TO ABWASSER.spezialbauwerk - # --- baseclass --- - # --- sia405_baseclass --- - **qgep_export_utils.base_common(row, "spezialbauwerk"), - # --- abwasserbauwerk --- - **qgep_export_utils.wastewater_structure_common(row), - # --- spezialbauwerk --- - # TODO : WARNING : upper_elevation is not mapped - bypass=qgep_export_utils.get_vl(row.bypass__REL), - funktion=qgep_export_utils.get_vl(row.function__REL), - notueberlauf=qgep_export_utils.get_vl(row.emergency_spillway__REL), - regenbecken_anordnung=qgep_export_utils.get_vl(row.stormwater_tank_arrangement__REL), - ) - abwasser_session.add(spezialbauwerk) - qgep_export_utils.create_metaattributes(row) - print(".", end="") - logger.info("done") - abwasser_session.flush() + qgep_export_utils.export_special_structure() logger.info( "Exporting QGEP.infiltration_installation -> ABWASSER.versickerungsanlage, ABWASSER.metaattribute" ) - query = qgep_session.query(QGEP.infiltration_installation) + query = qgep_session.query(qgep_model.infiltration_installation) if filtered: - query = query.join(QGEP.wastewater_networkelement).filter( - QGEP.wastewater_networkelement.obj_id.in_(subset_ids) + query = query.join(qgep_model.wastewater_networkelement).filter( + qgep_model.wastewater_networkelement.obj_id.in_(subset_ids) ) for row in query: # AVAILABLE FIELDS IN QGEP.infiltration_installation @@ -302,7 +158,7 @@ def qgep_export(selection=None, labels_file=None, orientation=None, basket_enabl logger.warning( "QGEP field infiltration_installation.upper_elevation has no equivalent in the interlis model. It will be ignored." ) - versickerungsanlage = ABWASSER.versickerungsanlage( + versickerungsanlage = abwasser_model.versickerungsanlage( # FIELDS TO MAP TO ABWASSER.versickerungsanlage # --- baseclass --- # --- sia405_baseclass --- @@ -331,99 +187,17 @@ def qgep_export(selection=None, labels_file=None, orientation=None, basket_enabl abwasser_session.flush() logger.info("Exporting QGEP.pipe_profile -> ABWASSER.rohrprofil, ABWASSER.metaattribute") - query = qgep_session.query(QGEP.pipe_profile) - if filtered: - query = query.join(QGEP.reach).filter( - QGEP.wastewater_networkelement.obj_id.in_(subset_ids) - ) - for row in query: - - # AVAILABLE FIELDS IN QGEP.pipe_profile - - # --- pipe_profile --- - # fk_dataowner, fk_provider, height_width_ratio, identifier, last_modification, obj_id, profile_type, remark - - # --- _bwrel_ --- - # profile_geometry__BWREL_fk_pipe_profile, reach__BWREL_fk_pipe_profile - - # --- _rel_ --- - # fk_dataowner__REL, fk_provider__REL, profile_type__REL - - rohrprofil = ABWASSER.rohrprofil( - # FIELDS TO MAP TO ABWASSER.rohrprofil - # --- baseclass --- - # --- sia405_baseclass --- - **qgep_export_utils.base_common(row, "rohrprofil"), - # --- rohrprofil --- - bemerkung=qgep_export_utils.truncate( - qgep_export_utils.emptystr_to_null(row.remark), 80 - ), - bezeichnung=qgep_export_utils.null_to_emptystr(row.identifier), - hoehenbreitenverhaeltnis=row.height_width_ratio, - profiltyp=qgep_export_utils.get_vl(row.profile_type__REL), - ) - abwasser_session.add(rohrprofil) - qgep_export_utils.create_metaattributes(row) - print(".", end="") - logger.info("done") - abwasser_session.flush() + qgep_export_utils.export_pipe_profile() logger.info("Exporting QGEP.reach_point -> ABWASSER.haltungspunkt, ABWASSER.metaattribute") - query = qgep_session.query(QGEP.reach_point) - if filtered: - query = query.join( - QGEP.reach, - or_( - QGEP.reach_point.obj_id == QGEP.reach.fk_reach_point_from, - QGEP.reach_point.obj_id == QGEP.reach.fk_reach_point_to, - ), - ).filter(QGEP.wastewater_networkelement.obj_id.in_(subset_ids)) - for row in query: - - # AVAILABLE FIELDS IN QGEP.reach_point - - # --- reach_point --- - # elevation_accuracy, fk_dataowner, fk_provider, fk_wastewater_networkelement, identifier, last_modification, level, obj_id, outlet_shape, position_of_connection, remark, situation_geometry - - # --- _bwrel_ --- - # examination__BWREL_fk_reach_point, reach__BWREL_fk_reach_point_from, reach__BWREL_fk_reach_point_to - - # --- _rel_ --- - # elevation_accuracy__REL, fk_dataowner__REL, fk_provider__REL, fk_wastewater_networkelement__REL, outlet_shape__REL - - haltungspunkt = ABWASSER.haltungspunkt( - # FIELDS TO MAP TO ABWASSER.haltungspunkt - # --- baseclass --- - # --- sia405_baseclass --- - **qgep_export_utils.base_common(row, "haltungspunkt"), - # --- haltungspunkt --- - # changed call from qgep_export_utils.get_tid to qgep_export_utils.check_fk_in_subsetid so it does not wirte foreignkeys on elements that do not exist - # abwassernetzelementref=qgep_export_utils.get_tid(row.fk_wastewater_networkelement__REL), - abwassernetzelementref=qgep_export_utils.check_fk_in_subsetid( - subset_ids, row.fk_wastewater_networkelement__REL, filtered - ), - auslaufform=qgep_export_utils.get_vl(row.outlet_shape__REL), - bemerkung=qgep_export_utils.truncate( - qgep_export_utils.emptystr_to_null(row.remark), 80 - ), - bezeichnung=qgep_export_utils.null_to_emptystr(row.identifier), - hoehengenauigkeit=qgep_export_utils.get_vl(row.elevation_accuracy__REL), - kote=row.level, - lage=ST_Force2D(row.situation_geometry), - lage_anschluss=row.position_of_connection, - ) - abwasser_session.add(haltungspunkt) - qgep_export_utils.create_metaattributes(row) - print(".", end="") - logger.info("done") - abwasser_session.flush() + qgep_export_utils.export_reach_point() logger.info( "Exporting QGEP.wastewater_node -> ABWASSER.abwasserknoten, ABWASSER.metaattribute" ) - query = qgep_session.query(QGEP.wastewater_node) + query = qgep_session.query(qgep_model.wastewater_node) if filtered: - query = query.filter(QGEP.wastewater_networkelement.obj_id.in_(subset_ids)) + query = query.filter(qgep_model.wastewater_networkelement.obj_id.in_(subset_ids)) for row in query: # AVAILABLE FIELDS IN QGEP.wastewater_node @@ -440,7 +214,7 @@ def qgep_export(selection=None, labels_file=None, orientation=None, basket_enabl # QGEP field wastewater_node.fk_hydr_geometry has no equivalent in the interlis model. It will be ignored. - abwasserknoten = ABWASSER.abwasserknoten( + abwasserknoten = abwasser_model.abwasserknoten( # FIELDS TO MAP TO ABWASSER.abwasserknoten # --- baseclass --- # --- sia405_baseclass --- @@ -460,267 +234,35 @@ def qgep_export(selection=None, labels_file=None, orientation=None, basket_enabl abwasser_session.flush() logger.info("Exporting QGEP.reach -> ABWASSER.haltung, ABWASSER.metaattribute") - query = qgep_session.query(QGEP.reach) - if filtered: - query = query.filter(QGEP.wastewater_networkelement.obj_id.in_(subset_ids)) - for row in query: - # AVAILABLE FIELDS IN QGEP.reach - - # --- wastewater_networkelement --- - # fk_dataowner, fk_provider, fk_wastewater_structure, identifier, last_modification, remark - - # --- reach --- - # clear_height, coefficient_of_friction, elevation_determination, fk_pipe_profile, fk_reach_point_from, fk_reach_point_to, horizontal_positioning, inside_coating, length_effective, material, obj_id, progression_geometry, reliner_material, reliner_nominal_size, relining_construction, relining_kind, ring_stiffness, slope_building_plan, wall_roughness - - # --- _bwrel_ --- - # catchment_area__BWREL_fk_wastewater_networkelement_rw_current, catchment_area__BWREL_fk_wastewater_networkelement_rw_planned, catchment_area__BWREL_fk_wastewater_networkelement_ww_current, catchment_area__BWREL_fk_wastewater_networkelement_ww_planned, connection_object__BWREL_fk_wastewater_networkelement, reach_point__BWREL_fk_wastewater_networkelement, reach_text__BWREL_fk_reach, txt_text__BWREL_fk_reach - - # --- _rel_ --- - # elevation_determination__REL, fk_dataowner__REL, fk_pipe_profile__REL, fk_provider__REL, fk_reach_point_from__REL, fk_reach_point_to__REL, fk_wastewater_structure__REL, horizontal_positioning__REL, inside_coating__REL, material__REL, reliner_material__REL, relining_construction__REL, relining_kind__REL - - # QGEP field reach.elevation_determination has no equivalent in the interlis model. It will be ignored. - - haltung = ABWASSER.haltung( - # FIELDS TO MAP TO ABWASSER.haltung - # --- baseclass --- - # --- sia405_baseclass --- - **qgep_export_utils.base_common(row, "haltung"), - # --- abwassernetzelement --- - **qgep_export_utils.wastewater_networkelement_common(row), - # --- haltung --- - # NOT MAPPED : elevation_determination - innenschutz=qgep_export_utils.get_vl(row.inside_coating__REL), - laengeeffektiv=row.length_effective, - lagebestimmung=qgep_export_utils.get_vl(row.horizontal_positioning__REL), - lichte_hoehe=row.clear_height, - material=qgep_export_utils.get_vl(row.material__REL), - nachhaltungspunktref=qgep_export_utils.get_tid(row.fk_reach_point_to__REL), - plangefaelle=row.slope_building_plan, # TODO : check, does this need conversion ? - reibungsbeiwert=row.coefficient_of_friction, - reliner_art=qgep_export_utils.get_vl(row.relining_kind__REL), - reliner_bautechnik=qgep_export_utils.get_vl(row.relining_construction__REL), - reliner_material=qgep_export_utils.get_vl(row.reliner_material__REL), - reliner_nennweite=row.reliner_nominal_size, - ringsteifigkeit=row.ring_stiffness, - rohrprofilref=qgep_export_utils.get_tid(row.fk_pipe_profile__REL), - verlauf=ST_Force2D(row.progression_geometry), - # -- attribute 3D --- - # verlauf3d=row.progression3d, - vonhaltungspunktref=qgep_export_utils.get_tid(row.fk_reach_point_from__REL), - wandrauhigkeit=row.wall_roughness, - ) - abwasser_session.add(haltung) - qgep_export_utils.create_metaattributes(row) - print(".", end="") - logger.info("done") - abwasser_session.flush() + qgep_export_utils.export_reach() logger.info( "Exporting QGEP.dryweather_downspout -> ABWASSER.trockenwetterfallrohr, ABWASSER.metaattribute" ) - query = qgep_session.query(QGEP.dryweather_downspout) - if filtered: - query = query.join(QGEP.wastewater_structure, QGEP.wastewater_networkelement).filter( - QGEP.wastewater_networkelement.obj_id.in_(subset_ids) - ) - for row in query: - # AVAILABLE FIELDS IN QGEP.dryweather_downspout - - # --- structure_part --- - # fk_dataowner, fk_provider, fk_wastewater_structure, identifier, last_modification, remark, renovation_demand - - # --- dryweather_downspout --- - # diameter, obj_id - - # --- _bwrel_ --- - # access_aid_kind__BWREL_obj_id, backflow_prevention__BWREL_obj_id, benching_kind__BWREL_obj_id, dryweather_flume_material__BWREL_obj_id, electric_equipment__BWREL_obj_id, electromechanical_equipment__BWREL_obj_id, solids_retention__BWREL_obj_id, tank_cleaning__BWREL_obj_id, tank_emptying__BWREL_obj_id - - # --- _rel_ --- - # fk_dataowner__REL, fk_provider__REL, fk_wastewater_structure__REL, renovation_demand__REL - - trockenwetterfallrohr = ABWASSER.trockenwetterfallrohr( - # FIELDS TO MAP TO ABWASSER.trockenwetterfallrohr - # --- baseclass --- - # --- sia405_baseclass --- - **qgep_export_utils.base_common(row, "trockenwetterfallrohr"), - # --- bauwerksteil --- - **qgep_export_utils.structure_part_common(row), - # --- trockenwetterfallrohr --- - durchmesser=row.diameter, - ) - abwasser_session.add(trockenwetterfallrohr) - qgep_export_utils.create_metaattributes(row) - print(".", end="") - logger.info("done") - abwasser_session.flush() + qgep_export_utils.export_dryweather_downspout() logger.info("Exporting QGEP.access_aid -> ABWASSER.einstiegshilfe, ABWASSER.metaattribute") - query = qgep_session.query(QGEP.access_aid) - if filtered: - query = query.join(QGEP.wastewater_structure, QGEP.wastewater_networkelement).filter( - QGEP.wastewater_networkelement.obj_id.in_(subset_ids) - ) - for row in query: - # AVAILABLE FIELDS IN QGEP.access_aid - - # --- structure_part --- - # fk_dataowner, fk_provider, fk_wastewater_structure, identifier, last_modification, remark, renovation_demand - - # --- access_aid --- - # kind, obj_id - - # --- _bwrel_ --- - # access_aid_kind__BWREL_obj_id, backflow_prevention__BWREL_obj_id, benching_kind__BWREL_obj_id, dryweather_flume_material__BWREL_obj_id, electric_equipment__BWREL_obj_id, electromechanical_equipment__BWREL_obj_id, solids_retention__BWREL_obj_id, tank_cleaning__BWREL_obj_id, tank_emptying__BWREL_obj_id - - # --- _rel_ --- - # fk_dataowner__REL, fk_provider__REL, fk_wastewater_structure__REL, kind__REL, renovation_demand__REL - - einstiegshilfe = ABWASSER.einstiegshilfe( - # FIELDS TO MAP TO ABWASSER.einstiegshilfe - # --- baseclass --- - # --- sia405_baseclass --- - **qgep_export_utils.base_common(row, "einstiegshilfe"), - # --- bauwerksteil --- - **qgep_export_utils.structure_part_common(row), - # --- einstiegshilfe --- - art=qgep_export_utils.get_vl(row.kind__REL), - ) - abwasser_session.add(einstiegshilfe) - qgep_export_utils.create_metaattributes(row) - print(".", end="") - logger.info("done") - abwasser_session.flush() + qgep_export_utils.export_access_aid() logger.info( "Exporting QGEP.dryweather_flume -> ABWASSER.trockenwetterrinne, ABWASSER.metaattribute" ) - query = qgep_session.query(QGEP.dryweather_flume) - if filtered: - query = query.join(QGEP.wastewater_structure, QGEP.wastewater_networkelement).filter( - QGEP.wastewater_networkelement.obj_id.in_(subset_ids) - ) - for row in query: - # AVAILABLE FIELDS IN QGEP.dryweather_flume - - # --- structure_part --- - # fk_dataowner, fk_provider, fk_wastewater_structure, identifier, last_modification, remark, renovation_demand - - # --- dryweather_flume --- - # material, obj_id - - # --- _bwrel_ --- - # access_aid_kind__BWREL_obj_id, backflow_prevention__BWREL_obj_id, benching_kind__BWREL_obj_id, dryweather_flume_material__BWREL_obj_id, electric_equipment__BWREL_obj_id, electromechanical_equipment__BWREL_obj_id, solids_retention__BWREL_obj_id, tank_cleaning__BWREL_obj_id, tank_emptying__BWREL_obj_id - - # --- _rel_ --- - # fk_dataowner__REL, fk_provider__REL, fk_wastewater_structure__REL, material__REL, renovation_demand__REL - - trockenwetterrinne = ABWASSER.trockenwetterrinne( - # FIELDS TO MAP TO ABWASSER.trockenwetterrinne - # --- baseclass --- - # --- sia405_baseclass --- - **qgep_export_utils.base_common(row, "trockenwetterrinne"), - # --- bauwerksteil --- - **qgep_export_utils.structure_part_common(row), - # --- trockenwetterrinne --- - material=qgep_export_utils.get_vl(row.material__REL), - ) - abwasser_session.add(trockenwetterrinne) - qgep_export_utils.create_metaattributes(row) - print(".", end="") - logger.info("done") - abwasser_session.flush() + qgep_export_utils.export_dryweather_flume() logger.info("Exporting QGEP.cover -> ABWASSER.deckel, ABWASSER.metaattribute") - query = qgep_session.query(QGEP.cover) - if filtered: - query = query.join(QGEP.wastewater_structure, QGEP.wastewater_networkelement).filter( - QGEP.wastewater_networkelement.obj_id.in_(subset_ids) - ) - for row in query: - # AVAILABLE FIELDS IN QGEP.cover - - # --- structure_part --- - # fk_dataowner, fk_provider, fk_wastewater_structure, identifier, last_modification, remark, renovation_demand - - # --- cover --- - # brand, cover_shape, diameter, fastening, level, material, obj_id, positional_accuracy, situation_geometry, sludge_bucket, venting - - # --- _bwrel_ --- - # access_aid_kind__BWREL_obj_id, backflow_prevention__BWREL_obj_id, benching_kind__BWREL_obj_id, dryweather_flume_material__BWREL_obj_id, electric_equipment__BWREL_obj_id, electromechanical_equipment__BWREL_obj_id, solids_retention__BWREL_obj_id, tank_cleaning__BWREL_obj_id, tank_emptying__BWREL_obj_id, wastewater_structure__BWREL_fk_main_cover - - # --- _rel_ --- - # cover_shape__REL, fastening__REL, fk_dataowner__REL, fk_provider__REL, fk_wastewater_structure__REL, material__REL, positional_accuracy__REL, renovation_demand__REL, sludge_bucket__REL, venting__REL - - deckel = ABWASSER.deckel( - # FIELDS TO MAP TO ABWASSER.deckel - # --- baseclass --- - # --- sia405_baseclass --- - **qgep_export_utils.base_common(row, "deckel"), - # --- bauwerksteil --- - **qgep_export_utils.structure_part_common(row), - # --- deckel --- - deckelform=qgep_export_utils.get_vl(row.cover_shape__REL), - durchmesser=row.diameter, - entlueftung=qgep_export_utils.get_vl(row.venting__REL), - fabrikat=row.brand, - kote=row.level, - lage=ST_Force2D(row.situation_geometry), - lagegenauigkeit=qgep_export_utils.get_vl(row.positional_accuracy__REL), - material=qgep_export_utils.get_vl(row.material__REL), - schlammeimer=qgep_export_utils.get_vl(row.sludge_bucket__REL), - verschluss=qgep_export_utils.get_vl(row.fastening__REL), - ) - abwasser_session.add(deckel) - qgep_export_utils.create_metaattributes(row) - print(".", end="") - logger.info("done") - abwasser_session.flush() + qgep_export_utils.export_cover() logger.info("Exporting QGEP.benching -> ABWASSER.bankett, ABWASSER.metaattribute") - query = qgep_session.query(QGEP.benching) - if filtered: - query = query.join(QGEP.wastewater_structure, QGEP.wastewater_networkelement).filter( - QGEP.wastewater_networkelement.obj_id.in_(subset_ids) - ) - for row in query: - # AVAILABLE FIELDS IN QGEP.benching - - # --- structure_part --- - # fk_dataowner, fk_provider, fk_wastewater_structure, identifier, last_modification, remark, renovation_demand - - # --- benching --- - # kind, obj_id - - # --- _bwrel_ --- - # access_aid_kind__BWREL_obj_id, backflow_prevention__BWREL_obj_id, benching_kind__BWREL_obj_id, dryweather_flume_material__BWREL_obj_id, electric_equipment__BWREL_obj_id, electromechanical_equipment__BWREL_obj_id, solids_retention__BWREL_obj_id, tank_cleaning__BWREL_obj_id, tank_emptying__BWREL_obj_id - - # --- _rel_ --- - # fk_dataowner__REL, fk_provider__REL, fk_wastewater_structure__REL, kind__REL, renovation_demand__REL - - bankett = ABWASSER.bankett( - # FIELDS TO MAP TO ABWASSER.bankett - # --- baseclass --- - # --- sia405_baseclass --- - **qgep_export_utils.base_common(row, "bankett"), - # --- bauwerksteil --- - **qgep_export_utils.structure_part_common(row), - # --- bankett --- - art=qgep_export_utils.get_vl(row.kind__REL), - ) - abwasser_session.add(bankett) - qgep_export_utils.create_metaattributes(row) - print(".", end="") - logger.info("done") - abwasser_session.flush() + qgep_export_utils.export_benching() logger.info("Exporting QGEP.examination -> ABWASSER.untersuchung, ABWASSER.metaattribute") - query = qgep_session.query(QGEP.examination) + query = qgep_session.query(qgep_model.examination) if filtered: query = ( - query.join(QGEP.re_maintenance_event_wastewater_structure) - .join(QGEP.wastewater_structure) - .join(QGEP.wastewater_networkelement) - .filter(QGEP.wastewater_networkelement.obj_id.in_(subset_ids)) + query.join(qgep_model.re_maintenance_event_wastewater_structure) + .join(qgep_model.wastewater_structure) + .join(qgep_model.wastewater_networkelement) + .filter(qgep_model.wastewater_networkelement.obj_id.in_(subset_ids)) ) for row in query: @@ -740,7 +282,7 @@ def qgep_export(selection=None, labels_file=None, orientation=None, basket_enabl "QGEP field maintenance_event.active_zone has no equivalent in the interlis model. It will be ignored." ) - untersuchung = ABWASSER.untersuchung( + untersuchung = abwasser_model.untersuchung( # FIELDS TO MAP TO ABWASSER.untersuchung # --- baseclass --- # --- sia405_baseclass --- @@ -784,14 +326,14 @@ def qgep_export(selection=None, labels_file=None, orientation=None, basket_enabl logger.info( "Exporting QGEP.damage_manhole -> ABWASSER.normschachtschaden, ABWASSER.metaattribute" ) - query = qgep_session.query(QGEP.damage_manhole) + query = qgep_session.query(qgep_model.damage_manhole) if filtered: query = ( - query.join(QGEP.examination) - .join(QGEP.re_maintenance_event_wastewater_structure) - .join(QGEP.wastewater_structure) - .join(QGEP.wastewater_networkelement) - .filter(QGEP.wastewater_networkelement.obj_id.in_(subset_ids)) + query.join(qgep_model.examination) + .join(qgep_model.re_maintenance_event_wastewater_structure) + .join(qgep_model.wastewater_structure) + .join(qgep_model.wastewater_networkelement) + .filter(qgep_model.wastewater_networkelement.obj_id.in_(subset_ids)) ) for row in query: @@ -808,7 +350,7 @@ def qgep_export(selection=None, labels_file=None, orientation=None, basket_enabl # --- _rel_ --- # connection__REL, fk_dataowner__REL, fk_examination__REL, fk_provider__REL, manhole_damage_code__REL, manhole_shaft_area__REL, single_damage_class__REL - normschachtschaden = ABWASSER.normschachtschaden( + normschachtschaden = abwasser_model.normschachtschaden( # FIELDS TO MAP TO ABWASSER.normschachtschaden # --- baseclass --- # --- sia405_baseclass --- @@ -837,14 +379,14 @@ def qgep_export(selection=None, labels_file=None, orientation=None, basket_enabl abwasser_session.flush() logger.info("Exporting QGEP.damage_channel -> ABWASSER.kanalschaden, ABWASSER.metaattribute") - query = qgep_session.query(QGEP.damage_channel) + query = qgep_session.query(qgep_model.damage_channel) if filtered: query = ( - query.join(QGEP.examination) - .join(QGEP.re_maintenance_event_wastewater_structure) - .join(QGEP.wastewater_structure) - .join(QGEP.wastewater_networkelement) - .filter(QGEP.wastewater_networkelement.obj_id.in_(subset_ids)) + query.join(qgep_model.examination) + .join(qgep_model.re_maintenance_event_wastewater_structure) + .join(qgep_model.wastewater_structure) + .join(qgep_model.wastewater_networkelement) + .filter(qgep_model.wastewater_networkelement.obj_id.in_(subset_ids)) ) for row in query: @@ -862,7 +404,7 @@ def qgep_export(selection=None, labels_file=None, orientation=None, basket_enabl # --- _rel_ --- # channel_damage_code__REL, connection__REL, fk_dataowner__REL, fk_examination__REL, fk_provider__REL, single_damage_class__REL - kanalschaden = ABWASSER.kanalschaden( + kanalschaden = abwasser_model.kanalschaden( # FIELDS TO MAP TO ABWASSER.kanalschaden # --- baseclass --- # --- sia405_baseclass --- @@ -890,7 +432,7 @@ def qgep_export(selection=None, labels_file=None, orientation=None, basket_enabl abwasser_session.flush() logger.info("Exporting QGEP.data_media -> ABWASSER.datentraeger, ABWASSER.metaattribute") - query = qgep_session.query(QGEP.data_media) + query = qgep_session.query(qgep_model.data_media) for row in query: # AVAILABLE FIELDS IN QGEP.data_media @@ -901,7 +443,7 @@ def qgep_export(selection=None, labels_file=None, orientation=None, basket_enabl # --- _rel_ --- # fk_dataowner__REL, fk_provider__REL, kind__REL - datentraeger = ABWASSER.datentraeger( + datentraeger = abwasser_model.datentraeger( # FIELDS TO MAP TO ABWASSER.datentraeger # --- baseclass --- # --- sia405_baseclass --- @@ -922,21 +464,21 @@ def qgep_export(selection=None, labels_file=None, orientation=None, basket_enabl abwasser_session.flush() logger.info("Exporting QGEP.file -> ABWASSER.datei, ABWASSER.metaattribute") - query = qgep_session.query(QGEP.file) + query = qgep_session.query(qgep_model.file) if filtered: query = ( - query.outerjoin(QGEP.damage, QGEP.file.object == QGEP.damage.obj_id) + query.outerjoin(qgep_model.damage, qgep_model.file.object == qgep_model.damage.obj_id) .join( - QGEP.examination, + qgep_model.examination, or_( - QGEP.file.object == QGEP.damage.obj_id, - QGEP.file.object == QGEP.examination.obj_id, + qgep_model.file.object == qgep_model.damage.obj_id, + qgep_model.file.object == qgep_model.examination.obj_id, ), ) - .join(QGEP.re_maintenance_event_wastewater_structure) - .join(QGEP.wastewater_structure) - .join(QGEP.wastewater_networkelement) - .filter(QGEP.wastewater_networkelement.obj_id.in_(subset_ids)) + .join(qgep_model.re_maintenance_event_wastewater_structure) + .join(qgep_model.wastewater_structure) + .join(qgep_model.wastewater_networkelement) + .filter(qgep_model.wastewater_networkelement.obj_id.in_(subset_ids)) ) for row in query: @@ -948,7 +490,7 @@ def qgep_export(selection=None, labels_file=None, orientation=None, basket_enabl # --- _rel_ --- # class__REL, fk_dataowner__REL, fk_provider__REL, kind__REL - datei = ABWASSER.datei( + datei = abwasser_model.datei( # FIELDS TO MAP TO ABWASSER.datei # --- baseclass --- # --- sia405_baseclass --- @@ -982,9 +524,9 @@ def qgep_export(selection=None, labels_file=None, orientation=None, basket_enabl "haltung": {}, "abwasserbauwerk": {}, } - for row in abwasser_session.query(ABWASSER.haltung): + for row in abwasser_session.query(abwasser_model.haltung): tid_for_obj_id["haltung"][row.obj_id] = row.t_id - for row in abwasser_session.query(ABWASSER.abwasserbauwerk): + for row in abwasser_session.query(abwasser_model.abwasserbauwerk): tid_for_obj_id["abwasserbauwerk"][row.obj_id] = row.t_id with open(labels_file) as labels_file_handle: @@ -1010,7 +552,7 @@ def qgep_export(selection=None, labels_file=None, orientation=None, basket_enabl f"Label for haltung `{obj_id}` exists, but that object is not part of the export" ) continue - ili_label = ABWASSER.haltung_text( + ili_label = abwasser_model.haltung_text( **qgep_export_utils.textpos_common(label, "haltung_text", geojson_crs_def), haltungref=tid_for_obj_id["haltung"][obj_id], ) @@ -1021,7 +563,7 @@ def qgep_export(selection=None, labels_file=None, orientation=None, basket_enabl f"Label for abwasserbauwerk `{obj_id}` exists, but that object is not part of the export" ) continue - ili_label = ABWASSER.abwasserbauwerk_text( + ili_label = abwasser_model.abwasserbauwerk_text( **qgep_export_utils.textpos_common( label, "abwasserbauwerk_text", geojson_crs_def ), diff --git a/qgepqwat2ili/qgep/export.py.tpl b/qgepqwat2ili/qgep/export.py.tpl deleted file mode 100644 index fc50d477..00000000 --- a/qgepqwat2ili/qgep/export.py.tpl +++ /dev/null @@ -1,833 +0,0 @@ -from sqlalchemy.orm import Session -from geoalchemy2.functions import ST_Transform, ST_Force2D - -from .. import utils - -from .model_qgep import get_qgep_model -from .model_abwasser import get_abwasser_model - - -def qgep_export(): - - QGEP = get_qgep_model() - ABWASSER = get_abwasser_model() - - qgep_session = Session(utils.sqlalchemy.create_engine(), autocommit=False, autoflush=False) - abwasser_session = Session(utils.sqlalchemy.create_engine(), autocommit=False, autoflush=False) - tid_maker = utils.ili2db.TidMaker(id_attribute='obj_id') - - def create_metaattributes(row, session): - metaattribute = ABWASSER.metaattribute( - # FIELDS TO MAP TO ABWASSER.metaattribute - # --- metaattribute --- - # datenherr=row.REPLACE_ME, - # datenlieferant=row.REPLACE_ME, - # letzte_aenderung=row.REPLACE_ME, - # sia405_baseclass_metaattribute=row.REPLACE_ME, - # t_id=row.REPLACE_ME - # t_seq=row.REPLACE_ME, - ) - session.add(metaattribute) - - print("Exporting QGEP.organisation -> ABWASSER.organisation, ABWASSER.metaattribute") - for row in qgep_session.query(QGEP.organisation): - - # organisation --- organisation.fk_dataowner, organisation.fk_provider, organisation.identifier, organisation.last_modification, organisation.obj_id, organisation.remark, organisation.uid - # _bwrel_ --- organisation.accident__BWREL_fk_dataowner, organisation.accident__BWREL_fk_provider, organisation.administrative_office__BWREL_obj_id, organisation.aquifier__BWREL_fk_dataowner, organisation.aquifier__BWREL_fk_provider, organisation.bathing_area__BWREL_fk_dataowner, organisation.bathing_area__BWREL_fk_provider, organisation.canton__BWREL_obj_id, organisation.catchment_area__BWREL_fk_dataowner, organisation.catchment_area__BWREL_fk_provider, organisation.connection_object__BWREL_fk_dataowner, organisation.connection_object__BWREL_fk_operator, organisation.connection_object__BWREL_fk_owner, organisation.connection_object__BWREL_fk_provider, organisation.control_center__BWREL_fk_dataowner, organisation.control_center__BWREL_fk_provider, organisation.cooperative__BWREL_obj_id, organisation.damage__BWREL_fk_dataowner, organisation.damage__BWREL_fk_provider, organisation.data_media__BWREL_fk_dataowner, organisation.data_media__BWREL_fk_provider, organisation.file__BWREL_fk_dataowner, organisation.file__BWREL_fk_provider, organisation.fish_pass__BWREL_fk_dataowner, organisation.fish_pass__BWREL_fk_provider, organisation.hazard_source__BWREL_fk_dataowner, organisation.hazard_source__BWREL_fk_owner, organisation.hazard_source__BWREL_fk_provider, organisation.hq_relation__BWREL_fk_dataowner, organisation.hq_relation__BWREL_fk_provider, organisation.hydr_geom_relation__BWREL_fk_dataowner, organisation.hydr_geom_relation__BWREL_fk_provider, organisation.hydr_geometry__BWREL_fk_dataowner, organisation.hydr_geometry__BWREL_fk_provider, organisation.hydraulic_char_data__BWREL_fk_dataowner, organisation.hydraulic_char_data__BWREL_fk_provider, organisation.maintenance_event__BWREL_fk_dataowner, organisation.maintenance_event__BWREL_fk_operating_company, organisation.maintenance_event__BWREL_fk_provider, organisation.measurement_result__BWREL_fk_dataowner, organisation.measurement_result__BWREL_fk_provider, organisation.measurement_series__BWREL_fk_dataowner, organisation.measurement_series__BWREL_fk_provider, organisation.measuring_device__BWREL_fk_dataowner, organisation.measuring_device__BWREL_fk_provider, organisation.measuring_point__BWREL_fk_dataowner, organisation.measuring_point__BWREL_fk_operator, organisation.measuring_point__BWREL_fk_provider, organisation.mechanical_pretreatment__BWREL_fk_dataowner, organisation.mechanical_pretreatment__BWREL_fk_provider, organisation.municipality__BWREL_obj_id, organisation.mutation__BWREL_fk_dataowner, organisation.mutation__BWREL_fk_provider, organisation.organisation__BWREL_fk_dataowner, organisation.organisation__BWREL_fk_provider, organisation.overflow__BWREL_fk_dataowner, organisation.overflow__BWREL_fk_provider, organisation.overflow_char__BWREL_fk_dataowner, organisation.overflow_char__BWREL_fk_provider, organisation.pipe_profile__BWREL_fk_dataowner, organisation.pipe_profile__BWREL_fk_provider, organisation.private__BWREL_obj_id, organisation.profile_geometry__BWREL_fk_dataowner, organisation.profile_geometry__BWREL_fk_provider, organisation.reach_point__BWREL_fk_dataowner, organisation.reach_point__BWREL_fk_provider, organisation.retention_body__BWREL_fk_dataowner, organisation.retention_body__BWREL_fk_provider, organisation.river_bank__BWREL_fk_dataowner, organisation.river_bank__BWREL_fk_provider, organisation.river_bed__BWREL_fk_dataowner, organisation.river_bed__BWREL_fk_provider, organisation.sector_water_body__BWREL_fk_dataowner, organisation.sector_water_body__BWREL_fk_provider, organisation.sludge_treatment__BWREL_fk_dataowner, organisation.sludge_treatment__BWREL_fk_provider, organisation.structure_part__BWREL_fk_dataowner, organisation.structure_part__BWREL_fk_provider, organisation.substance__BWREL_fk_dataowner, organisation.substance__BWREL_fk_provider, organisation.surface_runoff_parameters__BWREL_fk_dataowner, organisation.surface_runoff_parameters__BWREL_fk_provider, organisation.surface_water_bodies__BWREL_fk_dataowner, organisation.surface_water_bodies__BWREL_fk_provider, organisation.throttle_shut_off_unit__BWREL_fk_dataowner, organisation.throttle_shut_off_unit__BWREL_fk_provider, organisation.txt_symbol__BWREL_fk_dataowner, organisation.txt_symbol__BWREL_fk_provider, organisation.waste_water_association__BWREL_obj_id, organisation.waste_water_treatment__BWREL_fk_dataowner, organisation.waste_water_treatment__BWREL_fk_provider, organisation.waste_water_treatment_plant__BWREL_obj_id, organisation.wastewater_networkelement__BWREL_fk_dataowner, organisation.wastewater_networkelement__BWREL_fk_provider, organisation.wastewater_structure__BWREL_fk_dataowner, organisation.wastewater_structure__BWREL_fk_operator, organisation.wastewater_structure__BWREL_fk_owner, organisation.wastewater_structure__BWREL_fk_provider, organisation.wastewater_structure_symbol__BWREL_fk_dataowner, organisation.wastewater_structure_symbol__BWREL_fk_provider, organisation.water_catchment__BWREL_fk_dataowner, organisation.water_catchment__BWREL_fk_provider, organisation.water_control_structure__BWREL_fk_dataowner, organisation.water_control_structure__BWREL_fk_provider, organisation.water_course_segment__BWREL_fk_dataowner, organisation.water_course_segment__BWREL_fk_provider, organisation.wwtp_energy_use__BWREL_fk_dataowner, organisation.wwtp_energy_use__BWREL_fk_provider, organisation.zone__BWREL_fk_dataowner, organisation.zone__BWREL_fk_provider - # _rel_ --- organisation.fk_dataowner__REL, organisation.fk_provider__REL - - organisation = ABWASSER.organisation( - - # --- baseclass --- - # t_ili_tid=row.REPLACE_ME, # VARCHAR(200) - # t_type=row.REPLACE_ME, # VARCHAR(60) - - # --- sia405_baseclass --- - # obj_id=row.REPLACE_ME, # VARCHAR(16) - - # --- organisation --- - # auid=row.REPLACE_ME, # VARCHAR(12) - # bemerkung=row.REPLACE_ME, # VARCHAR(80) - # bezeichnung=row.REPLACE_ME, # VARCHAR(80) - # t_id=row.REPLACE_ME, # BIGINT - ) - abwasser_session.add(organisation) - create_metaattributes(row, session) - print(".", end="") - print("done") - - print("Exporting QGEP.channel -> ABWASSER.kanal, ABWASSER.metaattribute") - for row in qgep_session.query(QGEP.channel): - - # wastewater_structure --- channel._bottom_label, channel._cover_label, channel._depth, channel._function_hierarchic, channel._input_label, channel._label, channel._output_label, channel._usage_current, channel.accessibility, channel.contract_section, channel.detail_geometry_geometry, channel.financing, channel.fk_dataowner, channel.fk_main_cover, channel.fk_main_wastewater_node, channel.fk_operator, channel.fk_owner, channel.fk_provider, channel.gross_costs, channel.identifier, channel.inspection_interval, channel.last_modification, channel.location_name, channel.records, channel.remark, channel.renovation_necessity, channel.replacement_value, channel.rv_base_year, channel.rv_construction_type, channel.status, channel.structure_condition, channel.subsidies, channel.year_of_construction, channel.year_of_replacement - # channel --- channel.bedding_encasement, channel.connection_type, channel.function_hierarchic, channel.function_hydraulic, channel.jetting_interval, channel.obj_id, channel.pipe_length, channel.usage_current, channel.usage_planned - # _bwrel_ --- channel.measuring_point__BWREL_fk_wastewater_structure, channel.mechanical_pretreatment__BWREL_fk_wastewater_structure, channel.re_maintenance_event_wastewater_structure__BWREL_fk_wastewater_structure, channel.structure_part__BWREL_fk_wastewater_structure, channel.txt_symbol__BWREL_fk_wastewater_structure, channel.txt_text__BWREL_fk_wastewater_structure, channel.wastewater_networkelement__BWREL_fk_wastewater_structure, channel.wastewater_structure_symbol__BWREL_fk_wastewater_structure, channel.wastewater_structure_text__BWREL_fk_wastewater_structure, channel.wwtp_structure_kind__BWREL_obj_id - # _rel_ --- channel.accessibility__REL, channel.bedding_encasement__REL, channel.connection_type__REL, channel.financing__REL, channel.fk_dataowner__REL, channel.fk_main_cover__REL, channel.fk_main_wastewater_node__REL, channel.fk_operator__REL, channel.fk_owner__REL, channel.fk_provider__REL, channel.function_hierarchic__REL, channel.function_hydraulic__REL, channel.renovation_necessity__REL, channel.rv_construction_type__REL, channel.status__REL, channel.structure_condition__REL, channel.usage_current__REL, channel.usage_planned__REL - - kanal = ABWASSER.kanal( - - # --- baseclass --- - # t_ili_tid=row.REPLACE_ME, # VARCHAR(200) - # t_type=row.REPLACE_ME, # VARCHAR(60) - - # --- sia405_baseclass --- - # obj_id=row.REPLACE_ME, # VARCHAR(16) - - # --- abwasserbauwerk --- - # akten=row.REPLACE_ME, # VARCHAR(255) - # astatus=row.REPLACE_ME, # VARCHAR(255) - # baujahr=row.REPLACE_ME, # INTEGER - # baulicherzustand=row.REPLACE_ME, # VARCHAR(255) - # baulos=row.REPLACE_ME, # VARCHAR(50) - # bemerkung=row.REPLACE_ME, # VARCHAR(80) - # betreiberref=row.REPLACE_ME, # BIGINT - # bezeichnung=row.REPLACE_ME, # VARCHAR(20) - # bruttokosten=row.REPLACE_ME, # NUMERIC(10, 2) - # detailgeometrie=row.REPLACE_ME, # geometry(CURVEPOLYGON,2056) - # eigentuemerref=row.REPLACE_ME, # BIGINT - # ersatzjahr=row.REPLACE_ME, # INTEGER - # finanzierung=row.REPLACE_ME, # VARCHAR(255) - # inspektionsintervall=row.REPLACE_ME, # NUMERIC(4, 2) - # sanierungsbedarf=row.REPLACE_ME, # VARCHAR(255) - # standortname=row.REPLACE_ME, # VARCHAR(50) - # subventionen=row.REPLACE_ME, # NUMERIC(10, 2) - # wbw_basisjahr=row.REPLACE_ME, # INTEGER - # wbw_bauart=row.REPLACE_ME, # VARCHAR(255) - # wiederbeschaffungswert=row.REPLACE_ME, # NUMERIC(10, 2) - # zugaenglichkeit=row.REPLACE_ME, # VARCHAR(255) - - # --- kanal --- - # bettung_umhuellung=row.REPLACE_ME, # VARCHAR(255) - # funktionhierarchisch=row.REPLACE_ME, # VARCHAR(255) - # funktionhydraulisch=row.REPLACE_ME, # VARCHAR(255) - # nutzungsart_geplant=row.REPLACE_ME, # VARCHAR(255) - # nutzungsart_ist=row.REPLACE_ME, # VARCHAR(255) - # rohrlaenge=row.REPLACE_ME, # NUMERIC(7, 2) - # spuelintervall=row.REPLACE_ME, # NUMERIC(4, 2) - # t_id=row.REPLACE_ME, # BIGINT - # verbindungsart=row.REPLACE_ME, # VARCHAR(255) - ) - abwasser_session.add(kanal) - create_metaattributes(row, session) - print(".", end="") - print("done") - - print("Exporting QGEP.manhole -> ABWASSER.normschacht, ABWASSER.metaattribute") - for row in qgep_session.query(QGEP.manhole): - - # wastewater_structure --- manhole._bottom_label, manhole._cover_label, manhole._depth, manhole._function_hierarchic, manhole._input_label, manhole._label, manhole._output_label, manhole._usage_current, manhole.accessibility, manhole.contract_section, manhole.detail_geometry_geometry, manhole.financing, manhole.fk_dataowner, manhole.fk_main_cover, manhole.fk_main_wastewater_node, manhole.fk_operator, manhole.fk_owner, manhole.fk_provider, manhole.gross_costs, manhole.identifier, manhole.inspection_interval, manhole.last_modification, manhole.location_name, manhole.records, manhole.remark, manhole.renovation_necessity, manhole.replacement_value, manhole.rv_base_year, manhole.rv_construction_type, manhole.status, manhole.structure_condition, manhole.subsidies, manhole.year_of_construction, manhole.year_of_replacement - # manhole --- manhole._orientation, manhole.dimension1, manhole.dimension2, manhole.function, manhole.material, manhole.obj_id, manhole.surface_inflow - # _bwrel_ --- manhole.measuring_point__BWREL_fk_wastewater_structure, manhole.mechanical_pretreatment__BWREL_fk_wastewater_structure, manhole.re_maintenance_event_wastewater_structure__BWREL_fk_wastewater_structure, manhole.structure_part__BWREL_fk_wastewater_structure, manhole.txt_symbol__BWREL_fk_wastewater_structure, manhole.txt_text__BWREL_fk_wastewater_structure, manhole.wastewater_networkelement__BWREL_fk_wastewater_structure, manhole.wastewater_structure_symbol__BWREL_fk_wastewater_structure, manhole.wastewater_structure_text__BWREL_fk_wastewater_structure, manhole.wwtp_structure_kind__BWREL_obj_id - # _rel_ --- manhole.accessibility__REL, manhole.financing__REL, manhole.fk_dataowner__REL, manhole.fk_main_cover__REL, manhole.fk_main_wastewater_node__REL, manhole.fk_operator__REL, manhole.fk_owner__REL, manhole.fk_provider__REL, manhole.function__REL, manhole.material__REL, manhole.renovation_necessity__REL, manhole.rv_construction_type__REL, manhole.status__REL, manhole.structure_condition__REL, manhole.surface_inflow__REL - - normschacht = ABWASSER.normschacht( - - # --- baseclass --- - # t_ili_tid=row.REPLACE_ME, # VARCHAR(200) - # t_type=row.REPLACE_ME, # VARCHAR(60) - - # --- sia405_baseclass --- - # obj_id=row.REPLACE_ME, # VARCHAR(16) - - # --- abwasserbauwerk --- - # akten=row.REPLACE_ME, # VARCHAR(255) - # astatus=row.REPLACE_ME, # VARCHAR(255) - # baujahr=row.REPLACE_ME, # INTEGER - # baulicherzustand=row.REPLACE_ME, # VARCHAR(255) - # baulos=row.REPLACE_ME, # VARCHAR(50) - # bemerkung=row.REPLACE_ME, # VARCHAR(80) - # betreiberref=row.REPLACE_ME, # BIGINT - # bezeichnung=row.REPLACE_ME, # VARCHAR(20) - # bruttokosten=row.REPLACE_ME, # NUMERIC(10, 2) - # detailgeometrie=row.REPLACE_ME, # geometry(CURVEPOLYGON,2056) - # eigentuemerref=row.REPLACE_ME, # BIGINT - # ersatzjahr=row.REPLACE_ME, # INTEGER - # finanzierung=row.REPLACE_ME, # VARCHAR(255) - # inspektionsintervall=row.REPLACE_ME, # NUMERIC(4, 2) - # sanierungsbedarf=row.REPLACE_ME, # VARCHAR(255) - # standortname=row.REPLACE_ME, # VARCHAR(50) - # subventionen=row.REPLACE_ME, # NUMERIC(10, 2) - # wbw_basisjahr=row.REPLACE_ME, # INTEGER - # wbw_bauart=row.REPLACE_ME, # VARCHAR(255) - # wiederbeschaffungswert=row.REPLACE_ME, # NUMERIC(10, 2) - # zugaenglichkeit=row.REPLACE_ME, # VARCHAR(255) - - # --- normschacht --- - # dimension1=row.REPLACE_ME, # INTEGER - # dimension2=row.REPLACE_ME, # INTEGER - # funktion=row.REPLACE_ME, # VARCHAR(255) - # material=row.REPLACE_ME, # VARCHAR(255) - # oberflaechenzulauf=row.REPLACE_ME, # VARCHAR(255) - # t_id=row.REPLACE_ME, # BIGINT - ) - abwasser_session.add(normschacht) - create_metaattributes(row, session) - print(".", end="") - print("done") - - print("Exporting QGEP.discharge_point -> ABWASSER.einleitstelle, ABWASSER.metaattribute") - for row in qgep_session.query(QGEP.discharge_point): - - # wastewater_structure --- discharge_point._bottom_label, discharge_point._cover_label, discharge_point._depth, discharge_point._function_hierarchic, discharge_point._input_label, discharge_point._label, discharge_point._output_label, discharge_point._usage_current, discharge_point.accessibility, discharge_point.contract_section, discharge_point.detail_geometry_geometry, discharge_point.financing, discharge_point.fk_dataowner, discharge_point.fk_main_cover, discharge_point.fk_main_wastewater_node, discharge_point.fk_operator, discharge_point.fk_owner, discharge_point.fk_provider, discharge_point.gross_costs, discharge_point.identifier, discharge_point.inspection_interval, discharge_point.last_modification, discharge_point.location_name, discharge_point.records, discharge_point.remark, discharge_point.renovation_necessity, discharge_point.replacement_value, discharge_point.rv_base_year, discharge_point.rv_construction_type, discharge_point.status, discharge_point.structure_condition, discharge_point.subsidies, discharge_point.year_of_construction, discharge_point.year_of_replacement - # discharge_point --- discharge_point.fk_sector_water_body, discharge_point.highwater_level, discharge_point.obj_id, discharge_point.relevance, discharge_point.terrain_level, discharge_point.upper_elevation, discharge_point.waterlevel_hydraulic - # _bwrel_ --- discharge_point.measuring_point__BWREL_fk_wastewater_structure, discharge_point.mechanical_pretreatment__BWREL_fk_wastewater_structure, discharge_point.re_maintenance_event_wastewater_structure__BWREL_fk_wastewater_structure, discharge_point.structure_part__BWREL_fk_wastewater_structure, discharge_point.txt_symbol__BWREL_fk_wastewater_structure, discharge_point.txt_text__BWREL_fk_wastewater_structure, discharge_point.wastewater_networkelement__BWREL_fk_wastewater_structure, discharge_point.wastewater_structure_symbol__BWREL_fk_wastewater_structure, discharge_point.wastewater_structure_text__BWREL_fk_wastewater_structure, discharge_point.wwtp_structure_kind__BWREL_obj_id - # _rel_ --- discharge_point.accessibility__REL, discharge_point.financing__REL, discharge_point.fk_dataowner__REL, discharge_point.fk_main_cover__REL, discharge_point.fk_main_wastewater_node__REL, discharge_point.fk_operator__REL, discharge_point.fk_owner__REL, discharge_point.fk_provider__REL, discharge_point.fk_sector_water_body__REL, discharge_point.relevance__REL, discharge_point.renovation_necessity__REL, discharge_point.rv_construction_type__REL, discharge_point.status__REL, discharge_point.structure_condition__REL - - einleitstelle = ABWASSER.einleitstelle( - - # --- baseclass --- - # t_ili_tid=row.REPLACE_ME, # VARCHAR(200) - # t_type=row.REPLACE_ME, # VARCHAR(60) - - # --- sia405_baseclass --- - # obj_id=row.REPLACE_ME, # VARCHAR(16) - - # --- abwasserbauwerk --- - # akten=row.REPLACE_ME, # VARCHAR(255) - # astatus=row.REPLACE_ME, # VARCHAR(255) - # baujahr=row.REPLACE_ME, # INTEGER - # baulicherzustand=row.REPLACE_ME, # VARCHAR(255) - # baulos=row.REPLACE_ME, # VARCHAR(50) - # bemerkung=row.REPLACE_ME, # VARCHAR(80) - # betreiberref=row.REPLACE_ME, # BIGINT - # bezeichnung=row.REPLACE_ME, # VARCHAR(20) - # bruttokosten=row.REPLACE_ME, # NUMERIC(10, 2) - # detailgeometrie=row.REPLACE_ME, # geometry(CURVEPOLYGON,2056) - # eigentuemerref=row.REPLACE_ME, # BIGINT - # ersatzjahr=row.REPLACE_ME, # INTEGER - # finanzierung=row.REPLACE_ME, # VARCHAR(255) - # inspektionsintervall=row.REPLACE_ME, # NUMERIC(4, 2) - # sanierungsbedarf=row.REPLACE_ME, # VARCHAR(255) - # standortname=row.REPLACE_ME, # VARCHAR(50) - # subventionen=row.REPLACE_ME, # NUMERIC(10, 2) - # wbw_basisjahr=row.REPLACE_ME, # INTEGER - # wbw_bauart=row.REPLACE_ME, # VARCHAR(255) - # wiederbeschaffungswert=row.REPLACE_ME, # NUMERIC(10, 2) - # zugaenglichkeit=row.REPLACE_ME, # VARCHAR(255) - - # --- einleitstelle --- - # hochwasserkote=row.REPLACE_ME, # NUMERIC(7, 3) - # relevanz=row.REPLACE_ME, # VARCHAR(255) - # t_id=row.REPLACE_ME, # BIGINT - # terrainkote=row.REPLACE_ME, # NUMERIC(7, 3) - # wasserspiegel_hydraulik=row.REPLACE_ME, # NUMERIC(7, 3) - ) - abwasser_session.add(einleitstelle) - create_metaattributes(row, session) - print(".", end="") - print("done") - - print("Exporting QGEP.special_structure -> ABWASSER.spezialbauwerk, ABWASSER.metaattribute") - for row in qgep_session.query(QGEP.special_structure): - - # wastewater_structure --- special_structure._bottom_label, special_structure._cover_label, special_structure._depth, special_structure._function_hierarchic, special_structure._input_label, special_structure._label, special_structure._output_label, special_structure._usage_current, special_structure.accessibility, special_structure.contract_section, special_structure.detail_geometry_geometry, special_structure.financing, special_structure.fk_dataowner, special_structure.fk_main_cover, special_structure.fk_main_wastewater_node, special_structure.fk_operator, special_structure.fk_owner, special_structure.fk_provider, special_structure.gross_costs, special_structure.identifier, special_structure.inspection_interval, special_structure.last_modification, special_structure.location_name, special_structure.records, special_structure.remark, special_structure.renovation_necessity, special_structure.replacement_value, special_structure.rv_base_year, special_structure.rv_construction_type, special_structure.status, special_structure.structure_condition, special_structure.subsidies, special_structure.year_of_construction, special_structure.year_of_replacement - # special_structure --- special_structure.bypass, special_structure.emergency_spillway, special_structure.function, special_structure.obj_id, special_structure.stormwater_tank_arrangement, special_structure.upper_elevation - # _bwrel_ --- special_structure.measuring_point__BWREL_fk_wastewater_structure, special_structure.mechanical_pretreatment__BWREL_fk_wastewater_structure, special_structure.re_maintenance_event_wastewater_structure__BWREL_fk_wastewater_structure, special_structure.structure_part__BWREL_fk_wastewater_structure, special_structure.txt_symbol__BWREL_fk_wastewater_structure, special_structure.txt_text__BWREL_fk_wastewater_structure, special_structure.wastewater_networkelement__BWREL_fk_wastewater_structure, special_structure.wastewater_structure_symbol__BWREL_fk_wastewater_structure, special_structure.wastewater_structure_text__BWREL_fk_wastewater_structure, special_structure.wwtp_structure_kind__BWREL_obj_id - # _rel_ --- special_structure.accessibility__REL, special_structure.bypass__REL, special_structure.emergency_spillway__REL, special_structure.financing__REL, special_structure.fk_dataowner__REL, special_structure.fk_main_cover__REL, special_structure.fk_main_wastewater_node__REL, special_structure.fk_operator__REL, special_structure.fk_owner__REL, special_structure.fk_provider__REL, special_structure.function__REL, special_structure.renovation_necessity__REL, special_structure.rv_construction_type__REL, special_structure.status__REL, special_structure.stormwater_tank_arrangement__REL, special_structure.structure_condition__REL - - spezialbauwerk = ABWASSER.spezialbauwerk( - - # --- baseclass --- - # t_ili_tid=row.REPLACE_ME, # VARCHAR(200) - # t_type=row.REPLACE_ME, # VARCHAR(60) - - # --- sia405_baseclass --- - # obj_id=row.REPLACE_ME, # VARCHAR(16) - - # --- abwasserbauwerk --- - # akten=row.REPLACE_ME, # VARCHAR(255) - # astatus=row.REPLACE_ME, # VARCHAR(255) - # baujahr=row.REPLACE_ME, # INTEGER - # baulicherzustand=row.REPLACE_ME, # VARCHAR(255) - # baulos=row.REPLACE_ME, # VARCHAR(50) - # bemerkung=row.REPLACE_ME, # VARCHAR(80) - # betreiberref=row.REPLACE_ME, # BIGINT - # bezeichnung=row.REPLACE_ME, # VARCHAR(20) - # bruttokosten=row.REPLACE_ME, # NUMERIC(10, 2) - # detailgeometrie=row.REPLACE_ME, # geometry(CURVEPOLYGON,2056) - # eigentuemerref=row.REPLACE_ME, # BIGINT - # ersatzjahr=row.REPLACE_ME, # INTEGER - # finanzierung=row.REPLACE_ME, # VARCHAR(255) - # inspektionsintervall=row.REPLACE_ME, # NUMERIC(4, 2) - # sanierungsbedarf=row.REPLACE_ME, # VARCHAR(255) - # standortname=row.REPLACE_ME, # VARCHAR(50) - # subventionen=row.REPLACE_ME, # NUMERIC(10, 2) - # wbw_basisjahr=row.REPLACE_ME, # INTEGER - # wbw_bauart=row.REPLACE_ME, # VARCHAR(255) - # wiederbeschaffungswert=row.REPLACE_ME, # NUMERIC(10, 2) - # zugaenglichkeit=row.REPLACE_ME, # VARCHAR(255) - - # --- spezialbauwerk --- - # bypass=row.REPLACE_ME, # VARCHAR(255) - # funktion=row.REPLACE_ME, # VARCHAR(255) - # notueberlauf=row.REPLACE_ME, # VARCHAR(255) - # regenbecken_anordnung=row.REPLACE_ME, # VARCHAR(255) - # t_id=row.REPLACE_ME, # BIGINT - ) - abwasser_session.add(spezialbauwerk) - create_metaattributes(row, session) - print(".", end="") - print("done") - - print("Exporting QGEP.infiltration_installation -> ABWASSER.versickerungsanlage, ABWASSER.metaattribute") - for row in qgep_session.query(QGEP.infiltration_installation): - - # wastewater_structure --- infiltration_installation._bottom_label, infiltration_installation._cover_label, infiltration_installation._depth, infiltration_installation._function_hierarchic, infiltration_installation._input_label, infiltration_installation._label, infiltration_installation._output_label, infiltration_installation._usage_current, infiltration_installation.accessibility, infiltration_installation.contract_section, infiltration_installation.detail_geometry_geometry, infiltration_installation.financing, infiltration_installation.fk_dataowner, infiltration_installation.fk_main_cover, infiltration_installation.fk_main_wastewater_node, infiltration_installation.fk_operator, infiltration_installation.fk_owner, infiltration_installation.fk_provider, infiltration_installation.gross_costs, infiltration_installation.identifier, infiltration_installation.inspection_interval, infiltration_installation.last_modification, infiltration_installation.location_name, infiltration_installation.records, infiltration_installation.remark, infiltration_installation.renovation_necessity, infiltration_installation.replacement_value, infiltration_installation.rv_base_year, infiltration_installation.rv_construction_type, infiltration_installation.status, infiltration_installation.structure_condition, infiltration_installation.subsidies, infiltration_installation.year_of_construction, infiltration_installation.year_of_replacement - # infiltration_installation --- infiltration_installation.absorption_capacity, infiltration_installation.defects, infiltration_installation.dimension1, infiltration_installation.dimension2, infiltration_installation.distance_to_aquifer, infiltration_installation.effective_area, infiltration_installation.emergency_spillway, infiltration_installation.fk_aquifier, infiltration_installation.kind, infiltration_installation.labeling, infiltration_installation.obj_id, infiltration_installation.seepage_utilization, infiltration_installation.upper_elevation, infiltration_installation.vehicle_access, infiltration_installation.watertightness - # _bwrel_ --- infiltration_installation.measuring_point__BWREL_fk_wastewater_structure, infiltration_installation.mechanical_pretreatment__BWREL_fk_infiltration_installation, infiltration_installation.mechanical_pretreatment__BWREL_fk_wastewater_structure, infiltration_installation.re_maintenance_event_wastewater_structure__BWREL_fk_wastewater_structure, infiltration_installation.retention_body__BWREL_fk_infiltration_installation, infiltration_installation.structure_part__BWREL_fk_wastewater_structure, infiltration_installation.txt_symbol__BWREL_fk_wastewater_structure, infiltration_installation.txt_text__BWREL_fk_wastewater_structure, infiltration_installation.wastewater_networkelement__BWREL_fk_wastewater_structure, infiltration_installation.wastewater_structure_symbol__BWREL_fk_wastewater_structure, infiltration_installation.wastewater_structure_text__BWREL_fk_wastewater_structure, infiltration_installation.wwtp_structure_kind__BWREL_obj_id - # _rel_ --- infiltration_installation.accessibility__REL, infiltration_installation.defects__REL, infiltration_installation.emergency_spillway__REL, infiltration_installation.financing__REL, infiltration_installation.fk_aquifier__REL, infiltration_installation.fk_dataowner__REL, infiltration_installation.fk_main_cover__REL, infiltration_installation.fk_main_wastewater_node__REL, infiltration_installation.fk_operator__REL, infiltration_installation.fk_owner__REL, infiltration_installation.fk_provider__REL, infiltration_installation.kind__REL, infiltration_installation.labeling__REL, infiltration_installation.renovation_necessity__REL, infiltration_installation.rv_construction_type__REL, infiltration_installation.seepage_utilization__REL, infiltration_installation.status__REL, infiltration_installation.structure_condition__REL, infiltration_installation.vehicle_access__REL, infiltration_installation.watertightness__REL - - versickerungsanlage = ABWASSER.versickerungsanlage( - - # --- baseclass --- - # t_ili_tid=row.REPLACE_ME, # VARCHAR(200) - # t_type=row.REPLACE_ME, # VARCHAR(60) - - # --- sia405_baseclass --- - # obj_id=row.REPLACE_ME, # VARCHAR(16) - - # --- abwasserbauwerk --- - # akten=row.REPLACE_ME, # VARCHAR(255) - # astatus=row.REPLACE_ME, # VARCHAR(255) - # baujahr=row.REPLACE_ME, # INTEGER - # baulicherzustand=row.REPLACE_ME, # VARCHAR(255) - # baulos=row.REPLACE_ME, # VARCHAR(50) - # bemerkung=row.REPLACE_ME, # VARCHAR(80) - # betreiberref=row.REPLACE_ME, # BIGINT - # bezeichnung=row.REPLACE_ME, # VARCHAR(20) - # bruttokosten=row.REPLACE_ME, # NUMERIC(10, 2) - # detailgeometrie=row.REPLACE_ME, # geometry(CURVEPOLYGON,2056) - # eigentuemerref=row.REPLACE_ME, # BIGINT - # ersatzjahr=row.REPLACE_ME, # INTEGER - # finanzierung=row.REPLACE_ME, # VARCHAR(255) - # inspektionsintervall=row.REPLACE_ME, # NUMERIC(4, 2) - # sanierungsbedarf=row.REPLACE_ME, # VARCHAR(255) - # standortname=row.REPLACE_ME, # VARCHAR(50) - # subventionen=row.REPLACE_ME, # NUMERIC(10, 2) - # wbw_basisjahr=row.REPLACE_ME, # INTEGER - # wbw_bauart=row.REPLACE_ME, # VARCHAR(255) - # wiederbeschaffungswert=row.REPLACE_ME, # NUMERIC(10, 2) - # zugaenglichkeit=row.REPLACE_ME, # VARCHAR(255) - - # --- versickerungsanlage --- - # art=row.REPLACE_ME, # VARCHAR(255) - # beschriftung=row.REPLACE_ME, # VARCHAR(255) - # dimension1=row.REPLACE_ME, # INTEGER - # dimension2=row.REPLACE_ME, # INTEGER - # gwdistanz=row.REPLACE_ME, # NUMERIC(7, 2) - # maengel=row.REPLACE_ME, # VARCHAR(255) - # notueberlauf=row.REPLACE_ME, # VARCHAR(255) - # saugwagen=row.REPLACE_ME, # VARCHAR(255) - # schluckvermoegen=row.REPLACE_ME, # NUMERIC(9, 3) - # t_id=row.REPLACE_ME, # BIGINT - # versickerungswasser=row.REPLACE_ME, # VARCHAR(255) - # wasserdichtheit=row.REPLACE_ME, # VARCHAR(255) - # wirksameflaeche=row.REPLACE_ME, # NUMERIC(8, 2) - ) - abwasser_session.add(versickerungsanlage) - create_metaattributes(row, session) - print(".", end="") - print("done") - - print("Exporting QGEP.pipe_profile -> ABWASSER.rohrprofil, ABWASSER.metaattribute") - for row in qgep_session.query(QGEP.pipe_profile): - - # pipe_profile --- pipe_profile.fk_dataowner, pipe_profile.fk_provider, pipe_profile.height_width_ratio, pipe_profile.identifier, pipe_profile.last_modification, pipe_profile.obj_id, pipe_profile.profile_type, pipe_profile.remark - # _bwrel_ --- pipe_profile.profile_geometry__BWREL_fk_pipe_profile, pipe_profile.reach__BWREL_fk_pipe_profile - # _rel_ --- pipe_profile.fk_dataowner__REL, pipe_profile.fk_provider__REL, pipe_profile.profile_type__REL - - rohrprofil = ABWASSER.rohrprofil( - - # --- baseclass --- - # t_ili_tid=row.REPLACE_ME, # VARCHAR(200) - # t_type=row.REPLACE_ME, # VARCHAR(60) - - # --- sia405_baseclass --- - # obj_id=row.REPLACE_ME, # VARCHAR(16) - - # --- rohrprofil --- - # bemerkung=row.REPLACE_ME, # VARCHAR(80) - # bezeichnung=row.REPLACE_ME, # VARCHAR(20) - # hoehenbreitenverhaeltnis=row.REPLACE_ME, # NUMERIC(5, 2) - # profiltyp=row.REPLACE_ME, # VARCHAR(255) - # t_id=row.REPLACE_ME, # BIGINT - ) - abwasser_session.add(rohrprofil) - create_metaattributes(row, session) - print(".", end="") - print("done") - - print("Exporting QGEP.reach_point -> ABWASSER.haltungspunkt, ABWASSER.metaattribute") - for row in qgep_session.query(QGEP.reach_point): - - # reach_point --- reach_point.elevation_accuracy, reach_point.fk_dataowner, reach_point.fk_provider, reach_point.fk_wastewater_networkelement, reach_point.identifier, reach_point.last_modification, reach_point.level, reach_point.obj_id, reach_point.outlet_shape, reach_point.position_of_connection, reach_point.remark, reach_point.situation_geometry - # _bwrel_ --- reach_point.examination__BWREL_fk_reach_point, reach_point.reach__BWREL_fk_reach_point_from, reach_point.reach__BWREL_fk_reach_point_to - # _rel_ --- reach_point.elevation_accuracy__REL, reach_point.fk_dataowner__REL, reach_point.fk_provider__REL, reach_point.fk_wastewater_networkelement__REL, reach_point.outlet_shape__REL - - haltungspunkt = ABWASSER.haltungspunkt( - - # --- baseclass --- - # t_ili_tid=row.REPLACE_ME, # VARCHAR(200) - # t_type=row.REPLACE_ME, # VARCHAR(60) - - # --- sia405_baseclass --- - # obj_id=row.REPLACE_ME, # VARCHAR(16) - - # --- haltungspunkt --- - # abwassernetzelementref=row.REPLACE_ME, # BIGINT - # auslaufform=row.REPLACE_ME, # VARCHAR(255) - # bemerkung=row.REPLACE_ME, # VARCHAR(80) - # bezeichnung=row.REPLACE_ME, # VARCHAR(20) - # hoehengenauigkeit=row.REPLACE_ME, # VARCHAR(255) - # kote=row.REPLACE_ME, # NUMERIC(7, 3) - # lage=row.REPLACE_ME, # geometry(POINT,2056) - # lage_anschluss=row.REPLACE_ME, # INTEGER - # t_id=row.REPLACE_ME, # BIGINT - ) - abwasser_session.add(haltungspunkt) - create_metaattributes(row, session) - print(".", end="") - print("done") - - print("Exporting QGEP.wastewater_node -> ABWASSER.abwasserknoten, ABWASSER.metaattribute") - for row in qgep_session.query(QGEP.wastewater_node): - - # wastewater_networkelement --- wastewater_node.fk_dataowner, wastewater_node.fk_provider, wastewater_node.fk_wastewater_structure, wastewater_node.identifier, wastewater_node.last_modification, wastewater_node.remark - # wastewater_node --- wastewater_node.backflow_level, wastewater_node.bottom_level, wastewater_node.fk_hydr_geometry, wastewater_node.obj_id, wastewater_node.situation_geometry - # _bwrel_ --- wastewater_node.catchment_area__BWREL_fk_wastewater_networkelement_rw_current, wastewater_node.catchment_area__BWREL_fk_wastewater_networkelement_rw_planned, wastewater_node.catchment_area__BWREL_fk_wastewater_networkelement_ww_current, wastewater_node.catchment_area__BWREL_fk_wastewater_networkelement_ww_planned, wastewater_node.connection_object__BWREL_fk_wastewater_networkelement, wastewater_node.hydraulic_char_data__BWREL_fk_wastewater_node, wastewater_node.overflow__BWREL_fk_overflow_to, wastewater_node.overflow__BWREL_fk_wastewater_node, wastewater_node.reach_point__BWREL_fk_wastewater_networkelement, wastewater_node.throttle_shut_off_unit__BWREL_fk_wastewater_node, wastewater_node.wastewater_structure__BWREL_fk_main_wastewater_node - # _rel_ --- wastewater_node.fk_dataowner__REL, wastewater_node.fk_hydr_geometry__REL, wastewater_node.fk_provider__REL, wastewater_node.fk_wastewater_structure__REL - - abwasserknoten = ABWASSER.abwasserknoten( - - # --- baseclass --- - # t_ili_tid=row.REPLACE_ME, # VARCHAR(200) - # t_type=row.REPLACE_ME, # VARCHAR(60) - - # --- sia405_baseclass --- - # obj_id=row.REPLACE_ME, # VARCHAR(16) - - # --- abwassernetzelement --- - # abwasserbauwerkref=row.REPLACE_ME, # BIGINT - # bemerkung=row.REPLACE_ME, # VARCHAR(80) - # bezeichnung=row.REPLACE_ME, # VARCHAR(20) - - # --- abwasserknoten --- - # lage=row.REPLACE_ME, # geometry(POINT,2056) - # rueckstaukote=row.REPLACE_ME, # NUMERIC(7, 3) - # sohlenkote=row.REPLACE_ME, # NUMERIC(7, 3) - # t_id=row.REPLACE_ME, # BIGINT - ) - abwasser_session.add(abwasserknoten) - create_metaattributes(row, session) - print(".", end="") - print("done") - - print("Exporting QGEP.reach -> ABWASSER.haltung, ABWASSER.metaattribute") - for row in qgep_session.query(QGEP.reach): - - # wastewater_networkelement --- reach.fk_dataowner, reach.fk_provider, reach.fk_wastewater_structure, reach.identifier, reach.last_modification, reach.remark - # reach --- reach.clear_height, reach.coefficient_of_friction, reach.elevation_determination, reach.fk_pipe_profile, reach.fk_reach_point_from, reach.fk_reach_point_to, reach.horizontal_positioning, reach.inside_coating, reach.length_effective, reach.material, reach.obj_id, reach.progression_geometry, reach.reliner_material, reach.reliner_nominal_size, reach.relining_construction, reach.relining_kind, reach.ring_stiffness, reach.slope_building_plan, reach.wall_roughness - # _bwrel_ --- reach.catchment_area__BWREL_fk_wastewater_networkelement_rw_current, reach.catchment_area__BWREL_fk_wastewater_networkelement_rw_planned, reach.catchment_area__BWREL_fk_wastewater_networkelement_ww_current, reach.catchment_area__BWREL_fk_wastewater_networkelement_ww_planned, reach.connection_object__BWREL_fk_wastewater_networkelement, reach.reach_point__BWREL_fk_wastewater_networkelement, reach.reach_text__BWREL_fk_reach, reach.txt_text__BWREL_fk_reach - # _rel_ --- reach.elevation_determination__REL, reach.fk_dataowner__REL, reach.fk_pipe_profile__REL, reach.fk_provider__REL, reach.fk_reach_point_from__REL, reach.fk_reach_point_to__REL, reach.fk_wastewater_structure__REL, reach.horizontal_positioning__REL, reach.inside_coating__REL, reach.material__REL, reach.reliner_material__REL, reach.relining_construction__REL, reach.relining_kind__REL - - haltung = ABWASSER.haltung( - - # --- baseclass --- - # t_ili_tid=row.REPLACE_ME, # VARCHAR(200) - # t_type=row.REPLACE_ME, # VARCHAR(60) - - # --- sia405_baseclass --- - # obj_id=row.REPLACE_ME, # VARCHAR(16) - - # --- abwassernetzelement --- - # abwasserbauwerkref=row.REPLACE_ME, # BIGINT - # bemerkung=row.REPLACE_ME, # VARCHAR(80) - # bezeichnung=row.REPLACE_ME, # VARCHAR(20) - - # --- haltung --- - # innenschutz=row.REPLACE_ME, # VARCHAR(255) - # laengeeffektiv=row.REPLACE_ME, # NUMERIC(7, 2) - # lagebestimmung=row.REPLACE_ME, # VARCHAR(255) - # lichte_hoehe=row.REPLACE_ME, # INTEGER - # material=row.REPLACE_ME, # VARCHAR(255) - # nachhaltungspunktref=row.REPLACE_ME, # BIGINT - # plangefaelle=row.REPLACE_ME, # INTEGER - # reibungsbeiwert=row.REPLACE_ME, # INTEGER - # reliner_art=row.REPLACE_ME, # VARCHAR(255) - # reliner_bautechnik=row.REPLACE_ME, # VARCHAR(255) - # reliner_material=row.REPLACE_ME, # VARCHAR(255) - # reliner_nennweite=row.REPLACE_ME, # INTEGER - # ringsteifigkeit=row.REPLACE_ME, # INTEGER - # rohrprofilref=row.REPLACE_ME, # BIGINT - # t_id=row.REPLACE_ME, # BIGINT - # verlauf=row.REPLACE_ME, # geometry(COMPOUNDCURVE,2056) - # vonhaltungspunktref=row.REPLACE_ME, # BIGINT - # wandrauhigkeit=row.REPLACE_ME, # NUMERIC(5, 2) - ) - abwasser_session.add(haltung) - create_metaattributes(row, session) - print(".", end="") - print("done") - - print("Exporting QGEP.dryweather_downspout -> ABWASSER.trockenwetterfallrohr, ABWASSER.metaattribute") - for row in qgep_session.query(QGEP.dryweather_downspout): - - # structure_part --- dryweather_downspout.fk_dataowner, dryweather_downspout.fk_provider, dryweather_downspout.fk_wastewater_structure, dryweather_downspout.identifier, dryweather_downspout.last_modification, dryweather_downspout.remark, dryweather_downspout.renovation_demand - # dryweather_downspout --- dryweather_downspout.diameter, dryweather_downspout.obj_id - # _bwrel_ --- dryweather_downspout.access_aid_kind__BWREL_obj_id, dryweather_downspout.backflow_prevention__BWREL_obj_id, dryweather_downspout.benching_kind__BWREL_obj_id, dryweather_downspout.dryweather_flume_material__BWREL_obj_id, dryweather_downspout.electric_equipment__BWREL_obj_id, dryweather_downspout.electromechanical_equipment__BWREL_obj_id, dryweather_downspout.solids_retention__BWREL_obj_id, dryweather_downspout.tank_cleaning__BWREL_obj_id, dryweather_downspout.tank_emptying__BWREL_obj_id - # _rel_ --- dryweather_downspout.fk_dataowner__REL, dryweather_downspout.fk_provider__REL, dryweather_downspout.fk_wastewater_structure__REL, dryweather_downspout.renovation_demand__REL - - trockenwetterfallrohr = ABWASSER.trockenwetterfallrohr( - - # --- baseclass --- - # t_ili_tid=row.REPLACE_ME, # VARCHAR(200) - # t_type=row.REPLACE_ME, # VARCHAR(60) - - # --- sia405_baseclass --- - # obj_id=row.REPLACE_ME, # VARCHAR(16) - - # --- bauwerksteil --- - # abwasserbauwerkref=row.REPLACE_ME, # BIGINT - # bemerkung=row.REPLACE_ME, # VARCHAR(80) - # bezeichnung=row.REPLACE_ME, # VARCHAR(20) - # instandstellung=row.REPLACE_ME, # VARCHAR(255) - - # --- trockenwetterfallrohr --- - # durchmesser=row.REPLACE_ME, # INTEGER - # t_id=row.REPLACE_ME, # BIGINT - ) - abwasser_session.add(trockenwetterfallrohr) - create_metaattributes(row, session) - print(".", end="") - print("done") - - print("Exporting QGEP.access_aid -> ABWASSER.einstiegshilfe, ABWASSER.metaattribute") - for row in qgep_session.query(QGEP.access_aid): - - # structure_part --- access_aid.fk_dataowner, access_aid.fk_provider, access_aid.fk_wastewater_structure, access_aid.identifier, access_aid.last_modification, access_aid.remark, access_aid.renovation_demand - # access_aid --- access_aid.kind, access_aid.obj_id - # _bwrel_ --- access_aid.access_aid_kind__BWREL_obj_id, access_aid.backflow_prevention__BWREL_obj_id, access_aid.benching_kind__BWREL_obj_id, access_aid.dryweather_flume_material__BWREL_obj_id, access_aid.electric_equipment__BWREL_obj_id, access_aid.electromechanical_equipment__BWREL_obj_id, access_aid.solids_retention__BWREL_obj_id, access_aid.tank_cleaning__BWREL_obj_id, access_aid.tank_emptying__BWREL_obj_id - # _rel_ --- access_aid.fk_dataowner__REL, access_aid.fk_provider__REL, access_aid.fk_wastewater_structure__REL, access_aid.kind__REL, access_aid.renovation_demand__REL - - einstiegshilfe = ABWASSER.einstiegshilfe( - - # --- baseclass --- - # t_ili_tid=row.REPLACE_ME, # VARCHAR(200) - # t_type=row.REPLACE_ME, # VARCHAR(60) - - # --- sia405_baseclass --- - # obj_id=row.REPLACE_ME, # VARCHAR(16) - - # --- bauwerksteil --- - # abwasserbauwerkref=row.REPLACE_ME, # BIGINT - # bemerkung=row.REPLACE_ME, # VARCHAR(80) - # bezeichnung=row.REPLACE_ME, # VARCHAR(20) - # instandstellung=row.REPLACE_ME, # VARCHAR(255) - - # --- einstiegshilfe --- - # art=row.REPLACE_ME, # VARCHAR(255) - # t_id=row.REPLACE_ME, # BIGINT - ) - abwasser_session.add(einstiegshilfe) - create_metaattributes(row, session) - print(".", end="") - print("done") - - print("Exporting QGEP.dryweather_flume -> ABWASSER.trockenwetterrinne, ABWASSER.metaattribute") - for row in qgep_session.query(QGEP.dryweather_flume): - - # structure_part --- dryweather_flume.fk_dataowner, dryweather_flume.fk_provider, dryweather_flume.fk_wastewater_structure, dryweather_flume.identifier, dryweather_flume.last_modification, dryweather_flume.remark, dryweather_flume.renovation_demand - # dryweather_flume --- dryweather_flume.material, dryweather_flume.obj_id - # _bwrel_ --- dryweather_flume.access_aid_kind__BWREL_obj_id, dryweather_flume.backflow_prevention__BWREL_obj_id, dryweather_flume.benching_kind__BWREL_obj_id, dryweather_flume.dryweather_flume_material__BWREL_obj_id, dryweather_flume.electric_equipment__BWREL_obj_id, dryweather_flume.electromechanical_equipment__BWREL_obj_id, dryweather_flume.solids_retention__BWREL_obj_id, dryweather_flume.tank_cleaning__BWREL_obj_id, dryweather_flume.tank_emptying__BWREL_obj_id - # _rel_ --- dryweather_flume.fk_dataowner__REL, dryweather_flume.fk_provider__REL, dryweather_flume.fk_wastewater_structure__REL, dryweather_flume.material__REL, dryweather_flume.renovation_demand__REL - - trockenwetterrinne = ABWASSER.trockenwetterrinne( - - # --- baseclass --- - # t_ili_tid=row.REPLACE_ME, # VARCHAR(200) - # t_type=row.REPLACE_ME, # VARCHAR(60) - - # --- sia405_baseclass --- - # obj_id=row.REPLACE_ME, # VARCHAR(16) - - # --- bauwerksteil --- - # abwasserbauwerkref=row.REPLACE_ME, # BIGINT - # bemerkung=row.REPLACE_ME, # VARCHAR(80) - # bezeichnung=row.REPLACE_ME, # VARCHAR(20) - # instandstellung=row.REPLACE_ME, # VARCHAR(255) - - # --- trockenwetterrinne --- - # material=row.REPLACE_ME, # VARCHAR(255) - # t_id=row.REPLACE_ME, # BIGINT - ) - abwasser_session.add(trockenwetterrinne) - create_metaattributes(row, session) - print(".", end="") - print("done") - - print("Exporting QGEP.cover -> ABWASSER.deckel, ABWASSER.metaattribute") - for row in qgep_session.query(QGEP.cover): - - # structure_part --- cover.fk_dataowner, cover.fk_provider, cover.fk_wastewater_structure, cover.identifier, cover.last_modification, cover.remark, cover.renovation_demand - # cover --- cover.brand, cover.cover_shape, cover.diameter, cover.fastening, cover.level, cover.material, cover.obj_id, cover.positional_accuracy, cover.situation_geometry, cover.sludge_bucket, cover.venting - # _bwrel_ --- cover.access_aid_kind__BWREL_obj_id, cover.backflow_prevention__BWREL_obj_id, cover.benching_kind__BWREL_obj_id, cover.dryweather_flume_material__BWREL_obj_id, cover.electric_equipment__BWREL_obj_id, cover.electromechanical_equipment__BWREL_obj_id, cover.solids_retention__BWREL_obj_id, cover.tank_cleaning__BWREL_obj_id, cover.tank_emptying__BWREL_obj_id, cover.wastewater_structure__BWREL_fk_main_cover - # _rel_ --- cover.cover_shape__REL, cover.fastening__REL, cover.fk_dataowner__REL, cover.fk_provider__REL, cover.fk_wastewater_structure__REL, cover.material__REL, cover.positional_accuracy__REL, cover.renovation_demand__REL, cover.sludge_bucket__REL, cover.venting__REL - - deckel = ABWASSER.deckel( - - # --- baseclass --- - # t_ili_tid=row.REPLACE_ME, # VARCHAR(200) - # t_type=row.REPLACE_ME, # VARCHAR(60) - - # --- sia405_baseclass --- - # obj_id=row.REPLACE_ME, # VARCHAR(16) - - # --- bauwerksteil --- - # abwasserbauwerkref=row.REPLACE_ME, # BIGINT - # bemerkung=row.REPLACE_ME, # VARCHAR(80) - # bezeichnung=row.REPLACE_ME, # VARCHAR(20) - # instandstellung=row.REPLACE_ME, # VARCHAR(255) - - # --- deckel --- - # deckelform=row.REPLACE_ME, # VARCHAR(255) - # durchmesser=row.REPLACE_ME, # INTEGER - # entlueftung=row.REPLACE_ME, # VARCHAR(255) - # fabrikat=row.REPLACE_ME, # VARCHAR(50) - # kote=row.REPLACE_ME, # NUMERIC(7, 3) - # lage=row.REPLACE_ME, # geometry(POINT,2056) - # lagegenauigkeit=row.REPLACE_ME, # VARCHAR(255) - # material=row.REPLACE_ME, # VARCHAR(255) - # schlammeimer=row.REPLACE_ME, # VARCHAR(255) - # t_id=row.REPLACE_ME, # BIGINT - # verschluss=row.REPLACE_ME, # VARCHAR(255) - ) - abwasser_session.add(deckel) - create_metaattributes(row, session) - print(".", end="") - print("done") - - print("Exporting QGEP.benching -> ABWASSER.bankett, ABWASSER.metaattribute") - for row in qgep_session.query(QGEP.benching): - - # structure_part --- benching.fk_dataowner, benching.fk_provider, benching.fk_wastewater_structure, benching.identifier, benching.last_modification, benching.remark, benching.renovation_demand - # benching --- benching.kind, benching.obj_id - # _bwrel_ --- benching.access_aid_kind__BWREL_obj_id, benching.backflow_prevention__BWREL_obj_id, benching.benching_kind__BWREL_obj_id, benching.dryweather_flume_material__BWREL_obj_id, benching.electric_equipment__BWREL_obj_id, benching.electromechanical_equipment__BWREL_obj_id, benching.solids_retention__BWREL_obj_id, benching.tank_cleaning__BWREL_obj_id, benching.tank_emptying__BWREL_obj_id - # _rel_ --- benching.fk_dataowner__REL, benching.fk_provider__REL, benching.fk_wastewater_structure__REL, benching.kind__REL, benching.renovation_demand__REL - - bankett = ABWASSER.bankett( - - # --- baseclass --- - # t_ili_tid=row.REPLACE_ME, # VARCHAR(200) - # t_type=row.REPLACE_ME, # VARCHAR(60) - - # --- sia405_baseclass --- - # obj_id=row.REPLACE_ME, # VARCHAR(16) - - # --- bauwerksteil --- - # abwasserbauwerkref=row.REPLACE_ME, # BIGINT - # bemerkung=row.REPLACE_ME, # VARCHAR(80) - # bezeichnung=row.REPLACE_ME, # VARCHAR(20) - # instandstellung=row.REPLACE_ME, # VARCHAR(255) - - # --- bankett --- - # art=row.REPLACE_ME, # VARCHAR(255) - # t_id=row.REPLACE_ME, # BIGINT - ) - abwasser_session.add(bankett) - create_metaattributes(row, session) - print(".", end="") - print("done") - - print("Exporting QGEP.examination -> ABWASSER.untersuchung, ABWASSER.metaattribute") - for row in qgep_session.query(QGEP.examination): - - # maintenance_event --- examination.active_zone, examination.base_data, examination.cost, examination.data_details, examination.duration, examination.fk_dataowner, examination.fk_operating_company, examination.fk_provider, examination.identifier, examination.kind, examination.last_modification, examination.operator, examination.reason, examination.remark, examination.result, examination.status, examination.time_point - # examination --- examination.equipment, examination.fk_reach_point, examination.from_point_identifier, examination.inspected_length, examination.obj_id, examination.recording_type, examination.to_point_identifier, examination.vehicle, examination.videonumber, examination.weather - # _bwrel_ --- examination.damage__BWREL_fk_examination, examination.re_maintenance_event_wastewater_structure__BWREL_fk_maintenance_event - # _rel_ --- examination.fk_dataowner__REL, examination.fk_operating_company__REL, examination.fk_provider__REL, examination.fk_reach_point__REL, examination.kind__REL, examination.recording_type__REL, examination.status__REL, examination.weather__REL - - untersuchung = ABWASSER.untersuchung( - - # --- baseclass --- - # t_ili_tid=row.REPLACE_ME, # VARCHAR(200) - # t_type=row.REPLACE_ME, # VARCHAR(60) - - # --- sia405_baseclass --- - # obj_id=row.REPLACE_ME, # VARCHAR(16) - - # --- erhaltungsereignis --- - # abwasserbauwerkref=row.REPLACE_ME, # BIGINT - # art=row.REPLACE_ME, # VARCHAR(255) - # astatus=row.REPLACE_ME, # VARCHAR(255) - # ausfuehrende_firmaref=row.REPLACE_ME, # BIGINT - # ausfuehrender=row.REPLACE_ME, # VARCHAR(50) - # bemerkung=row.REPLACE_ME, # VARCHAR(80) - # bezeichnung=row.REPLACE_ME, # VARCHAR(20) - # datengrundlage=row.REPLACE_ME, # VARCHAR(50) - # dauer=row.REPLACE_ME, # INTEGER - # detaildaten=row.REPLACE_ME, # VARCHAR(50) - # ergebnis=row.REPLACE_ME, # VARCHAR(50) - # grund=row.REPLACE_ME, # VARCHAR(50) - # kosten=row.REPLACE_ME, # NUMERIC(10, 2) - # zeitpunkt=row.REPLACE_ME, # DATE - - # --- untersuchung --- - # bispunktbezeichnung=row.REPLACE_ME, # VARCHAR(20) - # erfassungsart=row.REPLACE_ME, # VARCHAR(255) - # fahrzeug=row.REPLACE_ME, # VARCHAR(50) - # geraet=row.REPLACE_ME, # VARCHAR(50) - # haltungspunktref=row.REPLACE_ME, # BIGINT - # inspizierte_laenge=row.REPLACE_ME, # NUMERIC(7, 2) - # t_id=row.REPLACE_ME, # BIGINT - # videonummer=row.REPLACE_ME, # VARCHAR(20) - # vonpunktbezeichnung=row.REPLACE_ME, # VARCHAR(20) - # witterung=row.REPLACE_ME, # VARCHAR(255) - ) - abwasser_session.add(untersuchung) - create_metaattributes(row, session) - print(".", end="") - print("done") - - print("Exporting QGEP.damage_manhole -> ABWASSER.normschachtschaden, ABWASSER.metaattribute") - for row in qgep_session.query(QGEP.damage_manhole): - - # damage --- damage_manhole.comments, damage_manhole.connection, damage_manhole.damage_begin, damage_manhole.damage_end, damage_manhole.damage_reach, damage_manhole.distance, damage_manhole.fk_dataowner, damage_manhole.fk_examination, damage_manhole.fk_provider, damage_manhole.last_modification, damage_manhole.quantification1, damage_manhole.quantification2, damage_manhole.single_damage_class, damage_manhole.video_counter, damage_manhole.view_parameters - # damage_manhole --- damage_manhole.manhole_damage_code, damage_manhole.manhole_shaft_area, damage_manhole.obj_id - # _bwrel_ --- damage_manhole.damage_channel_channel_damage_code__BWREL_obj_id - # _rel_ --- damage_manhole.connection__REL, damage_manhole.fk_dataowner__REL, damage_manhole.fk_examination__REL, damage_manhole.fk_provider__REL, damage_manhole.manhole_damage_code__REL, damage_manhole.manhole_shaft_area__REL, damage_manhole.single_damage_class__REL - - normschachtschaden = ABWASSER.normschachtschaden( - - # --- baseclass --- - # t_ili_tid=row.REPLACE_ME, # VARCHAR(200) - # t_type=row.REPLACE_ME, # VARCHAR(60) - - # --- sia405_baseclass --- - # obj_id=row.REPLACE_ME, # VARCHAR(16) - - # --- schaden --- - # anmerkung=row.REPLACE_ME, # VARCHAR(100) - # ansichtsparameter=row.REPLACE_ME, # VARCHAR(200) - # einzelschadenklasse=row.REPLACE_ME, # VARCHAR(255) - # streckenschaden=row.REPLACE_ME, # VARCHAR(3) - # untersuchungref=row.REPLACE_ME, # BIGINT - # verbindung=row.REPLACE_ME, # VARCHAR(255) - # videozaehlerstand=row.REPLACE_ME, # VARCHAR(255) - - # --- normschachtschaden --- - # distanz=row.REPLACE_ME, # NUMERIC(7, 2) - # quantifizierung1=row.REPLACE_ME, # VARCHAR(20) - # quantifizierung2=row.REPLACE_ME, # VARCHAR(20) - # schachtbereich=row.REPLACE_ME, # VARCHAR(255) - # schachtschadencode=row.REPLACE_ME, # VARCHAR(255) - # schadenlageanfang=row.REPLACE_ME, # INTEGER - # schadenlageende=row.REPLACE_ME, # INTEGER - # t_id=row.REPLACE_ME, # BIGINT - ) - abwasser_session.add(normschachtschaden) - create_metaattributes(row, session) - print(".", end="") - print("done") - - print("Exporting QGEP.damage_channel -> ABWASSER.kanalschaden, ABWASSER.metaattribute") - for row in qgep_session.query(QGEP.damage_channel): - - # damage --- damage_channel.comments, damage_channel.connection, damage_channel.damage_begin, damage_channel.damage_end, damage_channel.damage_reach, damage_channel.distance, damage_channel.fk_dataowner, damage_channel.fk_examination, damage_channel.fk_provider, damage_channel.last_modification, damage_channel.quantification1, damage_channel.quantification2, damage_channel.single_damage_class, damage_channel.video_counter, damage_channel.view_parameters - # damage_channel --- damage_channel.channel_damage_code, damage_channel.obj_id - # _bwrel_ --- damage_channel.damage_channel_channel_damage_code__BWREL_obj_id - # _rel_ --- damage_channel.channel_damage_code__REL, damage_channel.connection__REL, damage_channel.fk_dataowner__REL, damage_channel.fk_examination__REL, damage_channel.fk_provider__REL, damage_channel.single_damage_class__REL - - kanalschaden = ABWASSER.kanalschaden( - - # --- baseclass --- - # t_ili_tid=row.REPLACE_ME, # VARCHAR(200) - # t_type=row.REPLACE_ME, # VARCHAR(60) - - # --- sia405_baseclass --- - # obj_id=row.REPLACE_ME, # VARCHAR(16) - - # --- schaden --- - # anmerkung=row.REPLACE_ME, # VARCHAR(100) - # ansichtsparameter=row.REPLACE_ME, # VARCHAR(200) - # einzelschadenklasse=row.REPLACE_ME, # VARCHAR(255) - # streckenschaden=row.REPLACE_ME, # VARCHAR(3) - # untersuchungref=row.REPLACE_ME, # BIGINT - # verbindung=row.REPLACE_ME, # VARCHAR(255) - # videozaehlerstand=row.REPLACE_ME, # VARCHAR(255) - - # --- kanalschaden --- - # distanz=row.REPLACE_ME, # NUMERIC(7, 2) - # kanalschadencode=row.REPLACE_ME, # VARCHAR(255) - # quantifizierung1=row.REPLACE_ME, # INTEGER - # quantifizierung2=row.REPLACE_ME, # INTEGER - # schadenlageanfang=row.REPLACE_ME, # INTEGER - # schadenlageende=row.REPLACE_ME, # INTEGER - # t_id=row.REPLACE_ME, # BIGINT - ) - abwasser_session.add(kanalschaden) - create_metaattributes(row, session) - print(".", end="") - print("done") - - print("Exporting QGEP.data_media -> ABWASSER.datentraeger, ABWASSER.metaattribute") - for row in qgep_session.query(QGEP.data_media): - - # data_media --- data_media.fk_dataowner, data_media.fk_provider, data_media.identifier, data_media.kind, data_media.last_modification, data_media.location, data_media.obj_id, data_media.path, data_media.remark - # _rel_ --- data_media.fk_dataowner__REL, data_media.fk_provider__REL, data_media.kind__REL - - datentraeger = ABWASSER.datentraeger( - - # --- baseclass --- - # t_ili_tid=row.REPLACE_ME, # VARCHAR(200) - # t_type=row.REPLACE_ME, # VARCHAR(60) - - # --- sia405_baseclass --- - # obj_id=row.REPLACE_ME, # VARCHAR(16) - - # --- datentraeger --- - # art=row.REPLACE_ME, # VARCHAR(255) - # bemerkung=row.REPLACE_ME, # VARCHAR(80) - # bezeichnung=row.REPLACE_ME, # VARCHAR(60) - # pfad=row.REPLACE_ME, # VARCHAR(100) - # standort=row.REPLACE_ME, # VARCHAR(50) - # t_id=row.REPLACE_ME, # BIGINT - ) - abwasser_session.add(datentraeger) - create_metaattributes(row, session) - print(".", end="") - print("done") - - print("Exporting QGEP.file -> ABWASSER.datei, ABWASSER.metaattribute") - for row in qgep_session.query(QGEP.file): - - # file --- file.class, file.fk_data_media, file.fk_dataowner, file.fk_provider, file.identifier, file.kind, file.last_modification, file.obj_id, file.object, file.path_relative, file.remark - # _rel_ --- file.class__REL, file.fk_dataowner__REL, file.fk_provider__REL, file.kind__REL - - datei = ABWASSER.datei( - - # --- baseclass --- - # t_ili_tid=row.REPLACE_ME, # VARCHAR(200) - # t_type=row.REPLACE_ME, # VARCHAR(60) - - # --- sia405_baseclass --- - # obj_id=row.REPLACE_ME, # VARCHAR(16) - - # --- datei --- - # art=row.REPLACE_ME, # VARCHAR(255) - # bemerkung=row.REPLACE_ME, # VARCHAR(80) - # bezeichnung=row.REPLACE_ME, # VARCHAR(60) - # datentraegerref=row.REPLACE_ME, # BIGINT - # klasse=row.REPLACE_ME, # VARCHAR(255) - # objekt=row.REPLACE_ME, # VARCHAR(16) - # relativpfad=row.REPLACE_ME, # VARCHAR(200) - # t_id=row.REPLACE_ME, # BIGINT - ) - abwasser_session.add(datei) - create_metaattributes(row, session) - print(".", end="") - print("done") - - abwasser_session.commit() - - qgep_session.close() - abwasser_session.close() diff --git a/qgepqwat2ili/qgep/import_.py b/qgepqwat2ili/qgep/import_.py index e900dec0..6d8a36d0 100644 --- a/qgepqwat2ili/qgep/import_.py +++ b/qgepqwat2ili/qgep/import_.py @@ -11,7 +11,7 @@ from .model_qgep import get_qgep_model -def qgep_import(precommit_callback=None): +def qgep_import_kek(precommit_callback=None): """ Imports data from the ili2pg model into the QGEP model. diff --git a/qgepqwat2ili/qgep/import_.py.tpl b/qgepqwat2ili/qgep/import_.py.tpl deleted file mode 100644 index adddbe7b..00000000 --- a/qgepqwat2ili/qgep/import_.py.tpl +++ /dev/null @@ -1,875 +0,0 @@ -from sqlalchemy.orm import Session -from geoalchemy2.functions import ST_Transform, ST_Force2D - -from .. import utils - -from .model_qgep import get_qgep_model -from .model_abwasser import get_abwasser_model - - -def qgep_import(): - - QGEP = get_qgep_model() - ABWASSER = get_abwasser_model() - - abwasser_session = Session(utils.sqlalchemy.create_engine(), autocommit=False, autoflush=False) - qgep_session = Session(utils.sqlalchemy.create_engine(), autocommit=False, autoflush=False) - - print("Importing ABWASSER.organisation, ABWASSER.metaattribute -> QGEP.organisation") - for row, metaattribute in abwasser_session.query(ABWASSER.organisation, ABWASSER.metaattribute).join(ABWASSER.metaattribute): - - # baseclass --- organisation.t_ili_tid, organisation.t_type - # sia405_baseclass --- organisation.obj_id - # organisation --- organisation.auid, organisation.bemerkung, organisation.bezeichnung, organisation.t_id - - # metaattribute --- metaattribute.datenherr, metaattribute.datenlieferant, metaattribute.letzte_aenderung, metaattribute.sia405_baseclass_metaattribute, metaattribute.t_id, metaattribute.t_ili_tid, metaattribute.t_seq - # _rel_ --- metaattribute.sia405_baseclass_metaattribute__REL - - organisation = QGEP.organisation( - - # --- organisation --- - # fk_dataowner=row.REPLACE_ME, # VARCHAR(16) - # fk_provider=row.REPLACE_ME, # VARCHAR(16) - # identifier=row.REPLACE_ME, # VARCHAR(80) - # last_modification=row.REPLACE_ME, # TIMESTAMP WITHOUT TIME ZONE - # obj_id=row.REPLACE_ME, # VARCHAR(16) - # remark=row.REPLACE_ME, # VARCHAR(80) - # uid=row.REPLACE_ME, # VARCHAR(12) - ) - qgep_session.add(organisation) - print(".", end="") - print("done") - - print("Importing ABWASSER.kanal, ABWASSER.metaattribute -> QGEP.channel") - for row, metaattribute in abwasser_session.query(ABWASSER.kanal, ABWASSER.metaattribute).join(ABWASSER.metaattribute): - - # baseclass --- kanal.t_ili_tid, kanal.t_type - # sia405_baseclass --- kanal.obj_id - # abwasserbauwerk --- kanal.akten, kanal.astatus, kanal.baujahr, kanal.baulicherzustand, kanal.baulos, kanal.bemerkung, kanal.betreiberref, kanal.bezeichnung, kanal.bruttokosten, kanal.detailgeometrie, kanal.eigentuemerref, kanal.ersatzjahr, kanal.finanzierung, kanal.inspektionsintervall, kanal.sanierungsbedarf, kanal.standortname, kanal.subventionen, kanal.wbw_basisjahr, kanal.wbw_bauart, kanal.wiederbeschaffungswert, kanal.zugaenglichkeit - # kanal --- kanal.bettung_umhuellung, kanal.funktionhierarchisch, kanal.funktionhydraulisch, kanal.nutzungsart_geplant, kanal.nutzungsart_ist, kanal.rohrlaenge, kanal.spuelintervall, kanal.t_id, kanal.verbindungsart - # _bwrel_ --- kanal.abwassernetzelement__BWREL_abwasserbauwerkref, kanal.bauwerksteil__BWREL_abwasserbauwerkref, kanal.erhaltungsereignis__BWREL_abwasserbauwerkref, kanal.haltung_alternativverlauf__BWREL_t_id, kanal.metaattribute__BWREL_sia405_baseclass_metaattribute, kanal.sia405_symbolpos__BWREL_abwasserbauwerkref, kanal.sia405_textpos__BWREL_abwasserbauwerkref, kanal.symbolpos__BWREL_t_id, kanal.textpos__BWREL_t_id - # _rel_ --- kanal.betreiberref__REL, kanal.eigentuemerref__REL - - # metaattribute --- metaattribute.datenherr, metaattribute.datenlieferant, metaattribute.letzte_aenderung, metaattribute.sia405_baseclass_metaattribute, metaattribute.t_id, metaattribute.t_ili_tid, metaattribute.t_seq - # _rel_ --- metaattribute.sia405_baseclass_metaattribute__REL - - channel = QGEP.channel( - - # --- wastewater_structure --- - # _bottom_label=row.REPLACE_ME, # TEXT - # _cover_label=row.REPLACE_ME, # TEXT - # _depth=row.REPLACE_ME, # NUMERIC(6, 3) - # _function_hierarchic=row.REPLACE_ME, # INTEGER - # _input_label=row.REPLACE_ME, # TEXT - # _label=row.REPLACE_ME, # TEXT - # _output_label=row.REPLACE_ME, # TEXT - # _usage_current=row.REPLACE_ME, # INTEGER - # accessibility=row.REPLACE_ME, # INTEGER - # contract_section=row.REPLACE_ME, # VARCHAR(50) - # detail_geometry_geometry=row.REPLACE_ME, # geometry(CURVEPOLYGONZ,2056) - # financing=row.REPLACE_ME, # INTEGER - # fk_dataowner=row.REPLACE_ME, # VARCHAR(16) - # fk_main_cover=row.REPLACE_ME, # VARCHAR(16) - # fk_main_wastewater_node=row.REPLACE_ME, # VARCHAR(16) - # fk_operator=row.REPLACE_ME, # VARCHAR(16) - # fk_owner=row.REPLACE_ME, # VARCHAR(16) - # fk_provider=row.REPLACE_ME, # VARCHAR(16) - # gross_costs=row.REPLACE_ME, # NUMERIC(10, 2) - # identifier=row.REPLACE_ME, # VARCHAR(20) - # inspection_interval=row.REPLACE_ME, # NUMERIC(4, 2) - # last_modification=row.REPLACE_ME, # TIMESTAMP WITHOUT TIME ZONE - # location_name=row.REPLACE_ME, # VARCHAR(50) - # records=row.REPLACE_ME, # VARCHAR(255) - # remark=row.REPLACE_ME, # VARCHAR(80) - # renovation_necessity=row.REPLACE_ME, # INTEGER - # replacement_value=row.REPLACE_ME, # NUMERIC(10, 2) - # rv_base_year=row.REPLACE_ME, # SMALLINT - # rv_construction_type=row.REPLACE_ME, # INTEGER - # status=row.REPLACE_ME, # INTEGER - # structure_condition=row.REPLACE_ME, # INTEGER - # subsidies=row.REPLACE_ME, # NUMERIC(10, 2) - # year_of_construction=row.REPLACE_ME, # SMALLINT - # year_of_replacement=row.REPLACE_ME, # SMALLINT - - # --- channel --- - # bedding_encasement=row.REPLACE_ME, # INTEGER - # connection_type=row.REPLACE_ME, # INTEGER - # function_hierarchic=row.REPLACE_ME, # INTEGER - # function_hydraulic=row.REPLACE_ME, # INTEGER - # jetting_interval=row.REPLACE_ME, # NUMERIC(4, 2) - # obj_id=row.REPLACE_ME, # VARCHAR(16) - # pipe_length=row.REPLACE_ME, # NUMERIC(7, 2) - # usage_current=row.REPLACE_ME, # INTEGER - # usage_planned=row.REPLACE_ME, # INTEGER - ) - qgep_session.add(channel) - print(".", end="") - print("done") - - print("Importing ABWASSER.normschacht, ABWASSER.metaattribute -> QGEP.manhole") - for row, metaattribute in abwasser_session.query(ABWASSER.normschacht, ABWASSER.metaattribute).join(ABWASSER.metaattribute): - - # baseclass --- normschacht.t_ili_tid, normschacht.t_type - # sia405_baseclass --- normschacht.obj_id - # abwasserbauwerk --- normschacht.akten, normschacht.astatus, normschacht.baujahr, normschacht.baulicherzustand, normschacht.baulos, normschacht.bemerkung, normschacht.betreiberref, normschacht.bezeichnung, normschacht.bruttokosten, normschacht.detailgeometrie, normschacht.eigentuemerref, normschacht.ersatzjahr, normschacht.finanzierung, normschacht.inspektionsintervall, normschacht.sanierungsbedarf, normschacht.standortname, normschacht.subventionen, normschacht.wbw_basisjahr, normschacht.wbw_bauart, normschacht.wiederbeschaffungswert, normschacht.zugaenglichkeit - # normschacht --- normschacht.dimension1, normschacht.dimension2, normschacht.funktion, normschacht.material, normschacht.oberflaechenzulauf, normschacht.t_id - # _bwrel_ --- normschacht.abwassernetzelement__BWREL_abwasserbauwerkref, normschacht.bauwerksteil__BWREL_abwasserbauwerkref, normschacht.erhaltungsereignis__BWREL_abwasserbauwerkref, normschacht.haltung_alternativverlauf__BWREL_t_id, normschacht.metaattribute__BWREL_sia405_baseclass_metaattribute, normschacht.sia405_symbolpos__BWREL_abwasserbauwerkref, normschacht.sia405_textpos__BWREL_abwasserbauwerkref, normschacht.symbolpos__BWREL_t_id, normschacht.textpos__BWREL_t_id - # _rel_ --- normschacht.betreiberref__REL, normschacht.eigentuemerref__REL - - # metaattribute --- metaattribute.datenherr, metaattribute.datenlieferant, metaattribute.letzte_aenderung, metaattribute.sia405_baseclass_metaattribute, metaattribute.t_id, metaattribute.t_ili_tid, metaattribute.t_seq - # _rel_ --- metaattribute.sia405_baseclass_metaattribute__REL - - manhole = QGEP.manhole( - - # --- wastewater_structure --- - # _bottom_label=row.REPLACE_ME, # TEXT - # _cover_label=row.REPLACE_ME, # TEXT - # _depth=row.REPLACE_ME, # NUMERIC(6, 3) - # _function_hierarchic=row.REPLACE_ME, # INTEGER - # _input_label=row.REPLACE_ME, # TEXT - # _label=row.REPLACE_ME, # TEXT - # _output_label=row.REPLACE_ME, # TEXT - # _usage_current=row.REPLACE_ME, # INTEGER - # accessibility=row.REPLACE_ME, # INTEGER - # contract_section=row.REPLACE_ME, # VARCHAR(50) - # detail_geometry_geometry=row.REPLACE_ME, # geometry(CURVEPOLYGONZ,2056) - # financing=row.REPLACE_ME, # INTEGER - # fk_dataowner=row.REPLACE_ME, # VARCHAR(16) - # fk_main_cover=row.REPLACE_ME, # VARCHAR(16) - # fk_main_wastewater_node=row.REPLACE_ME, # VARCHAR(16) - # fk_operator=row.REPLACE_ME, # VARCHAR(16) - # fk_owner=row.REPLACE_ME, # VARCHAR(16) - # fk_provider=row.REPLACE_ME, # VARCHAR(16) - # gross_costs=row.REPLACE_ME, # NUMERIC(10, 2) - # identifier=row.REPLACE_ME, # VARCHAR(20) - # inspection_interval=row.REPLACE_ME, # NUMERIC(4, 2) - # last_modification=row.REPLACE_ME, # TIMESTAMP WITHOUT TIME ZONE - # location_name=row.REPLACE_ME, # VARCHAR(50) - # records=row.REPLACE_ME, # VARCHAR(255) - # remark=row.REPLACE_ME, # VARCHAR(80) - # renovation_necessity=row.REPLACE_ME, # INTEGER - # replacement_value=row.REPLACE_ME, # NUMERIC(10, 2) - # rv_base_year=row.REPLACE_ME, # SMALLINT - # rv_construction_type=row.REPLACE_ME, # INTEGER - # status=row.REPLACE_ME, # INTEGER - # structure_condition=row.REPLACE_ME, # INTEGER - # subsidies=row.REPLACE_ME, # NUMERIC(10, 2) - # year_of_construction=row.REPLACE_ME, # SMALLINT - # year_of_replacement=row.REPLACE_ME, # SMALLINT - - # --- manhole --- - # _orientation=row.REPLACE_ME, # NUMERIC - # dimension1=row.REPLACE_ME, # SMALLINT - # dimension2=row.REPLACE_ME, # SMALLINT - # function=row.REPLACE_ME, # INTEGER - # material=row.REPLACE_ME, # INTEGER - # obj_id=row.REPLACE_ME, # VARCHAR(16) - # surface_inflow=row.REPLACE_ME, # INTEGER - ) - qgep_session.add(manhole) - print(".", end="") - print("done") - - print("Importing ABWASSER.einleitstelle, ABWASSER.metaattribute -> QGEP.discharge_point") - for row, metaattribute in abwasser_session.query(ABWASSER.einleitstelle, ABWASSER.metaattribute).join(ABWASSER.metaattribute): - - # baseclass --- einleitstelle.t_ili_tid, einleitstelle.t_type - # sia405_baseclass --- einleitstelle.obj_id - # abwasserbauwerk --- einleitstelle.akten, einleitstelle.astatus, einleitstelle.baujahr, einleitstelle.baulicherzustand, einleitstelle.baulos, einleitstelle.bemerkung, einleitstelle.betreiberref, einleitstelle.bezeichnung, einleitstelle.bruttokosten, einleitstelle.detailgeometrie, einleitstelle.eigentuemerref, einleitstelle.ersatzjahr, einleitstelle.finanzierung, einleitstelle.inspektionsintervall, einleitstelle.sanierungsbedarf, einleitstelle.standortname, einleitstelle.subventionen, einleitstelle.wbw_basisjahr, einleitstelle.wbw_bauart, einleitstelle.wiederbeschaffungswert, einleitstelle.zugaenglichkeit - # einleitstelle --- einleitstelle.hochwasserkote, einleitstelle.relevanz, einleitstelle.t_id, einleitstelle.terrainkote, einleitstelle.wasserspiegel_hydraulik - # _bwrel_ --- einleitstelle.abwassernetzelement__BWREL_abwasserbauwerkref, einleitstelle.bauwerksteil__BWREL_abwasserbauwerkref, einleitstelle.erhaltungsereignis__BWREL_abwasserbauwerkref, einleitstelle.haltung_alternativverlauf__BWREL_t_id, einleitstelle.metaattribute__BWREL_sia405_baseclass_metaattribute, einleitstelle.sia405_symbolpos__BWREL_abwasserbauwerkref, einleitstelle.sia405_textpos__BWREL_abwasserbauwerkref, einleitstelle.symbolpos__BWREL_t_id, einleitstelle.textpos__BWREL_t_id - # _rel_ --- einleitstelle.betreiberref__REL, einleitstelle.eigentuemerref__REL - - # metaattribute --- metaattribute.datenherr, metaattribute.datenlieferant, metaattribute.letzte_aenderung, metaattribute.sia405_baseclass_metaattribute, metaattribute.t_id, metaattribute.t_ili_tid, metaattribute.t_seq - # _rel_ --- metaattribute.sia405_baseclass_metaattribute__REL - - discharge_point = QGEP.discharge_point( - - # --- wastewater_structure --- - # _bottom_label=row.REPLACE_ME, # TEXT - # _cover_label=row.REPLACE_ME, # TEXT - # _depth=row.REPLACE_ME, # NUMERIC(6, 3) - # _function_hierarchic=row.REPLACE_ME, # INTEGER - # _input_label=row.REPLACE_ME, # TEXT - # _label=row.REPLACE_ME, # TEXT - # _output_label=row.REPLACE_ME, # TEXT - # _usage_current=row.REPLACE_ME, # INTEGER - # accessibility=row.REPLACE_ME, # INTEGER - # contract_section=row.REPLACE_ME, # VARCHAR(50) - # detail_geometry_geometry=row.REPLACE_ME, # geometry(CURVEPOLYGONZ,2056) - # financing=row.REPLACE_ME, # INTEGER - # fk_dataowner=row.REPLACE_ME, # VARCHAR(16) - # fk_main_cover=row.REPLACE_ME, # VARCHAR(16) - # fk_main_wastewater_node=row.REPLACE_ME, # VARCHAR(16) - # fk_operator=row.REPLACE_ME, # VARCHAR(16) - # fk_owner=row.REPLACE_ME, # VARCHAR(16) - # fk_provider=row.REPLACE_ME, # VARCHAR(16) - # gross_costs=row.REPLACE_ME, # NUMERIC(10, 2) - # identifier=row.REPLACE_ME, # VARCHAR(20) - # inspection_interval=row.REPLACE_ME, # NUMERIC(4, 2) - # last_modification=row.REPLACE_ME, # TIMESTAMP WITHOUT TIME ZONE - # location_name=row.REPLACE_ME, # VARCHAR(50) - # records=row.REPLACE_ME, # VARCHAR(255) - # remark=row.REPLACE_ME, # VARCHAR(80) - # renovation_necessity=row.REPLACE_ME, # INTEGER - # replacement_value=row.REPLACE_ME, # NUMERIC(10, 2) - # rv_base_year=row.REPLACE_ME, # SMALLINT - # rv_construction_type=row.REPLACE_ME, # INTEGER - # status=row.REPLACE_ME, # INTEGER - # structure_condition=row.REPLACE_ME, # INTEGER - # subsidies=row.REPLACE_ME, # NUMERIC(10, 2) - # year_of_construction=row.REPLACE_ME, # SMALLINT - # year_of_replacement=row.REPLACE_ME, # SMALLINT - - # --- discharge_point --- - # fk_sector_water_body=row.REPLACE_ME, # VARCHAR(16) - # highwater_level=row.REPLACE_ME, # NUMERIC(7, 3) - # obj_id=row.REPLACE_ME, # VARCHAR(16) - # relevance=row.REPLACE_ME, # INTEGER - # terrain_level=row.REPLACE_ME, # NUMERIC(7, 3) - # upper_elevation=row.REPLACE_ME, # NUMERIC(7, 3) - # waterlevel_hydraulic=row.REPLACE_ME, # NUMERIC(7, 3) - ) - qgep_session.add(discharge_point) - print(".", end="") - print("done") - - print("Importing ABWASSER.spezialbauwerk, ABWASSER.metaattribute -> QGEP.special_structure") - for row, metaattribute in abwasser_session.query(ABWASSER.spezialbauwerk, ABWASSER.metaattribute).join(ABWASSER.metaattribute): - - # baseclass --- spezialbauwerk.t_ili_tid, spezialbauwerk.t_type - # sia405_baseclass --- spezialbauwerk.obj_id - # abwasserbauwerk --- spezialbauwerk.akten, spezialbauwerk.astatus, spezialbauwerk.baujahr, spezialbauwerk.baulicherzustand, spezialbauwerk.baulos, spezialbauwerk.bemerkung, spezialbauwerk.betreiberref, spezialbauwerk.bezeichnung, spezialbauwerk.bruttokosten, spezialbauwerk.detailgeometrie, spezialbauwerk.eigentuemerref, spezialbauwerk.ersatzjahr, spezialbauwerk.finanzierung, spezialbauwerk.inspektionsintervall, spezialbauwerk.sanierungsbedarf, spezialbauwerk.standortname, spezialbauwerk.subventionen, spezialbauwerk.wbw_basisjahr, spezialbauwerk.wbw_bauart, spezialbauwerk.wiederbeschaffungswert, spezialbauwerk.zugaenglichkeit - # spezialbauwerk --- spezialbauwerk.bypass, spezialbauwerk.funktion, spezialbauwerk.notueberlauf, spezialbauwerk.regenbecken_anordnung, spezialbauwerk.t_id - # _bwrel_ --- spezialbauwerk.abwassernetzelement__BWREL_abwasserbauwerkref, spezialbauwerk.bauwerksteil__BWREL_abwasserbauwerkref, spezialbauwerk.erhaltungsereignis__BWREL_abwasserbauwerkref, spezialbauwerk.haltung_alternativverlauf__BWREL_t_id, spezialbauwerk.metaattribute__BWREL_sia405_baseclass_metaattribute, spezialbauwerk.sia405_symbolpos__BWREL_abwasserbauwerkref, spezialbauwerk.sia405_textpos__BWREL_abwasserbauwerkref, spezialbauwerk.symbolpos__BWREL_t_id, spezialbauwerk.textpos__BWREL_t_id - # _rel_ --- spezialbauwerk.betreiberref__REL, spezialbauwerk.eigentuemerref__REL - - # metaattribute --- metaattribute.datenherr, metaattribute.datenlieferant, metaattribute.letzte_aenderung, metaattribute.sia405_baseclass_metaattribute, metaattribute.t_id, metaattribute.t_ili_tid, metaattribute.t_seq - # _rel_ --- metaattribute.sia405_baseclass_metaattribute__REL - - special_structure = QGEP.special_structure( - - # --- wastewater_structure --- - # _bottom_label=row.REPLACE_ME, # TEXT - # _cover_label=row.REPLACE_ME, # TEXT - # _depth=row.REPLACE_ME, # NUMERIC(6, 3) - # _function_hierarchic=row.REPLACE_ME, # INTEGER - # _input_label=row.REPLACE_ME, # TEXT - # _label=row.REPLACE_ME, # TEXT - # _output_label=row.REPLACE_ME, # TEXT - # _usage_current=row.REPLACE_ME, # INTEGER - # accessibility=row.REPLACE_ME, # INTEGER - # contract_section=row.REPLACE_ME, # VARCHAR(50) - # detail_geometry_geometry=row.REPLACE_ME, # geometry(CURVEPOLYGONZ,2056) - # financing=row.REPLACE_ME, # INTEGER - # fk_dataowner=row.REPLACE_ME, # VARCHAR(16) - # fk_main_cover=row.REPLACE_ME, # VARCHAR(16) - # fk_main_wastewater_node=row.REPLACE_ME, # VARCHAR(16) - # fk_operator=row.REPLACE_ME, # VARCHAR(16) - # fk_owner=row.REPLACE_ME, # VARCHAR(16) - # fk_provider=row.REPLACE_ME, # VARCHAR(16) - # gross_costs=row.REPLACE_ME, # NUMERIC(10, 2) - # identifier=row.REPLACE_ME, # VARCHAR(20) - # inspection_interval=row.REPLACE_ME, # NUMERIC(4, 2) - # last_modification=row.REPLACE_ME, # TIMESTAMP WITHOUT TIME ZONE - # location_name=row.REPLACE_ME, # VARCHAR(50) - # records=row.REPLACE_ME, # VARCHAR(255) - # remark=row.REPLACE_ME, # VARCHAR(80) - # renovation_necessity=row.REPLACE_ME, # INTEGER - # replacement_value=row.REPLACE_ME, # NUMERIC(10, 2) - # rv_base_year=row.REPLACE_ME, # SMALLINT - # rv_construction_type=row.REPLACE_ME, # INTEGER - # status=row.REPLACE_ME, # INTEGER - # structure_condition=row.REPLACE_ME, # INTEGER - # subsidies=row.REPLACE_ME, # NUMERIC(10, 2) - # year_of_construction=row.REPLACE_ME, # SMALLINT - # year_of_replacement=row.REPLACE_ME, # SMALLINT - - # --- special_structure --- - # bypass=row.REPLACE_ME, # INTEGER - # emergency_spillway=row.REPLACE_ME, # INTEGER - # function=row.REPLACE_ME, # INTEGER - # obj_id=row.REPLACE_ME, # VARCHAR(16) - # stormwater_tank_arrangement=row.REPLACE_ME, # INTEGER - # upper_elevation=row.REPLACE_ME, # NUMERIC(7, 3) - ) - qgep_session.add(special_structure) - print(".", end="") - print("done") - - print("Importing ABWASSER.versickerungsanlage, ABWASSER.metaattribute -> QGEP.infiltration_installation") - for row, metaattribute in abwasser_session.query(ABWASSER.versickerungsanlage, ABWASSER.metaattribute).join(ABWASSER.metaattribute): - - # baseclass --- versickerungsanlage.t_ili_tid, versickerungsanlage.t_type - # sia405_baseclass --- versickerungsanlage.obj_id - # abwasserbauwerk --- versickerungsanlage.akten, versickerungsanlage.astatus, versickerungsanlage.baujahr, versickerungsanlage.baulicherzustand, versickerungsanlage.baulos, versickerungsanlage.bemerkung, versickerungsanlage.betreiberref, versickerungsanlage.bezeichnung, versickerungsanlage.bruttokosten, versickerungsanlage.detailgeometrie, versickerungsanlage.eigentuemerref, versickerungsanlage.ersatzjahr, versickerungsanlage.finanzierung, versickerungsanlage.inspektionsintervall, versickerungsanlage.sanierungsbedarf, versickerungsanlage.standortname, versickerungsanlage.subventionen, versickerungsanlage.wbw_basisjahr, versickerungsanlage.wbw_bauart, versickerungsanlage.wiederbeschaffungswert, versickerungsanlage.zugaenglichkeit - # versickerungsanlage --- versickerungsanlage.art, versickerungsanlage.beschriftung, versickerungsanlage.dimension1, versickerungsanlage.dimension2, versickerungsanlage.gwdistanz, versickerungsanlage.maengel, versickerungsanlage.notueberlauf, versickerungsanlage.saugwagen, versickerungsanlage.schluckvermoegen, versickerungsanlage.t_id, versickerungsanlage.versickerungswasser, versickerungsanlage.wasserdichtheit, versickerungsanlage.wirksameflaeche - # _bwrel_ --- versickerungsanlage.abwassernetzelement__BWREL_abwasserbauwerkref, versickerungsanlage.bauwerksteil__BWREL_abwasserbauwerkref, versickerungsanlage.erhaltungsereignis__BWREL_abwasserbauwerkref, versickerungsanlage.haltung_alternativverlauf__BWREL_t_id, versickerungsanlage.metaattribute__BWREL_sia405_baseclass_metaattribute, versickerungsanlage.sia405_symbolpos__BWREL_abwasserbauwerkref, versickerungsanlage.sia405_textpos__BWREL_abwasserbauwerkref, versickerungsanlage.symbolpos__BWREL_t_id, versickerungsanlage.textpos__BWREL_t_id - # _rel_ --- versickerungsanlage.betreiberref__REL, versickerungsanlage.eigentuemerref__REL - - # metaattribute --- metaattribute.datenherr, metaattribute.datenlieferant, metaattribute.letzte_aenderung, metaattribute.sia405_baseclass_metaattribute, metaattribute.t_id, metaattribute.t_ili_tid, metaattribute.t_seq - # _rel_ --- metaattribute.sia405_baseclass_metaattribute__REL - - infiltration_installation = QGEP.infiltration_installation( - - # --- wastewater_structure --- - # _bottom_label=row.REPLACE_ME, # TEXT - # _cover_label=row.REPLACE_ME, # TEXT - # _depth=row.REPLACE_ME, # NUMERIC(6, 3) - # _function_hierarchic=row.REPLACE_ME, # INTEGER - # _input_label=row.REPLACE_ME, # TEXT - # _label=row.REPLACE_ME, # TEXT - # _output_label=row.REPLACE_ME, # TEXT - # _usage_current=row.REPLACE_ME, # INTEGER - # accessibility=row.REPLACE_ME, # INTEGER - # contract_section=row.REPLACE_ME, # VARCHAR(50) - # detail_geometry_geometry=row.REPLACE_ME, # geometry(CURVEPOLYGONZ,2056) - # financing=row.REPLACE_ME, # INTEGER - # fk_dataowner=row.REPLACE_ME, # VARCHAR(16) - # fk_main_cover=row.REPLACE_ME, # VARCHAR(16) - # fk_main_wastewater_node=row.REPLACE_ME, # VARCHAR(16) - # fk_operator=row.REPLACE_ME, # VARCHAR(16) - # fk_owner=row.REPLACE_ME, # VARCHAR(16) - # fk_provider=row.REPLACE_ME, # VARCHAR(16) - # gross_costs=row.REPLACE_ME, # NUMERIC(10, 2) - # identifier=row.REPLACE_ME, # VARCHAR(20) - # inspection_interval=row.REPLACE_ME, # NUMERIC(4, 2) - # last_modification=row.REPLACE_ME, # TIMESTAMP WITHOUT TIME ZONE - # location_name=row.REPLACE_ME, # VARCHAR(50) - # records=row.REPLACE_ME, # VARCHAR(255) - # remark=row.REPLACE_ME, # VARCHAR(80) - # renovation_necessity=row.REPLACE_ME, # INTEGER - # replacement_value=row.REPLACE_ME, # NUMERIC(10, 2) - # rv_base_year=row.REPLACE_ME, # SMALLINT - # rv_construction_type=row.REPLACE_ME, # INTEGER - # status=row.REPLACE_ME, # INTEGER - # structure_condition=row.REPLACE_ME, # INTEGER - # subsidies=row.REPLACE_ME, # NUMERIC(10, 2) - # year_of_construction=row.REPLACE_ME, # SMALLINT - # year_of_replacement=row.REPLACE_ME, # SMALLINT - - # --- infiltration_installation --- - # absorption_capacity=row.REPLACE_ME, # NUMERIC(9, 3) - # defects=row.REPLACE_ME, # INTEGER - # dimension1=row.REPLACE_ME, # SMALLINT - # dimension2=row.REPLACE_ME, # SMALLINT - # distance_to_aquifer=row.REPLACE_ME, # NUMERIC(7, 2) - # effective_area=row.REPLACE_ME, # NUMERIC(8, 2) - # emergency_spillway=row.REPLACE_ME, # INTEGER - # fk_aquifier=row.REPLACE_ME, # VARCHAR(16) - # kind=row.REPLACE_ME, # INTEGER - # labeling=row.REPLACE_ME, # INTEGER - # obj_id=row.REPLACE_ME, # VARCHAR(16) - # seepage_utilization=row.REPLACE_ME, # INTEGER - # upper_elevation=row.REPLACE_ME, # NUMERIC(7, 3) - # vehicle_access=row.REPLACE_ME, # INTEGER - # watertightness=row.REPLACE_ME, # INTEGER - ) - qgep_session.add(infiltration_installation) - print(".", end="") - print("done") - - print("Importing ABWASSER.rohrprofil, ABWASSER.metaattribute -> QGEP.pipe_profile") - for row, metaattribute in abwasser_session.query(ABWASSER.rohrprofil, ABWASSER.metaattribute).join(ABWASSER.metaattribute): - - # baseclass --- rohrprofil.t_ili_tid, rohrprofil.t_type - # sia405_baseclass --- rohrprofil.obj_id - # rohrprofil --- rohrprofil.bemerkung, rohrprofil.bezeichnung, rohrprofil.hoehenbreitenverhaeltnis, rohrprofil.profiltyp, rohrprofil.t_id - # _bwrel_ --- rohrprofil.haltung__BWREL_rohrprofilref, rohrprofil.haltung_alternativverlauf__BWREL_t_id, rohrprofil.metaattribute__BWREL_sia405_baseclass_metaattribute, rohrprofil.symbolpos__BWREL_t_id, rohrprofil.textpos__BWREL_t_id - - # metaattribute --- metaattribute.datenherr, metaattribute.datenlieferant, metaattribute.letzte_aenderung, metaattribute.sia405_baseclass_metaattribute, metaattribute.t_id, metaattribute.t_ili_tid, metaattribute.t_seq - # _rel_ --- metaattribute.sia405_baseclass_metaattribute__REL - - pipe_profile = QGEP.pipe_profile( - - # --- pipe_profile --- - # fk_dataowner=row.REPLACE_ME, # VARCHAR(16) - # fk_provider=row.REPLACE_ME, # VARCHAR(16) - # height_width_ratio=row.REPLACE_ME, # NUMERIC(5, 2) - # identifier=row.REPLACE_ME, # VARCHAR(20) - # last_modification=row.REPLACE_ME, # TIMESTAMP WITHOUT TIME ZONE - # obj_id=row.REPLACE_ME, # VARCHAR(16) - # profile_type=row.REPLACE_ME, # INTEGER - # remark=row.REPLACE_ME, # VARCHAR(80) - ) - qgep_session.add(pipe_profile) - print(".", end="") - print("done") - - print("Importing ABWASSER.haltungspunkt, ABWASSER.metaattribute -> QGEP.reach_point") - for row, metaattribute in abwasser_session.query(ABWASSER.haltungspunkt, ABWASSER.metaattribute).join(ABWASSER.metaattribute): - - # baseclass --- haltungspunkt.t_ili_tid, haltungspunkt.t_type - # sia405_baseclass --- haltungspunkt.obj_id - # haltungspunkt --- haltungspunkt.abwassernetzelementref, haltungspunkt.auslaufform, haltungspunkt.bemerkung, haltungspunkt.bezeichnung, haltungspunkt.hoehengenauigkeit, haltungspunkt.kote, haltungspunkt.lage, haltungspunkt.lage_anschluss, haltungspunkt.t_id - # _bwrel_ --- haltungspunkt.haltung__BWREL_nachhaltungspunktref, haltungspunkt.haltung__BWREL_vonhaltungspunktref, haltungspunkt.haltung_alternativverlauf__BWREL_t_id, haltungspunkt.metaattribute__BWREL_sia405_baseclass_metaattribute, haltungspunkt.symbolpos__BWREL_t_id, haltungspunkt.textpos__BWREL_t_id, haltungspunkt.untersuchung__BWREL_haltungspunktref - # _rel_ --- haltungspunkt.abwassernetzelementref__REL - - # metaattribute --- metaattribute.datenherr, metaattribute.datenlieferant, metaattribute.letzte_aenderung, metaattribute.sia405_baseclass_metaattribute, metaattribute.t_id, metaattribute.t_ili_tid, metaattribute.t_seq - # _rel_ --- metaattribute.sia405_baseclass_metaattribute__REL - - reach_point = QGEP.reach_point( - - # --- reach_point --- - # elevation_accuracy=row.REPLACE_ME, # INTEGER - # fk_dataowner=row.REPLACE_ME, # VARCHAR(16) - # fk_provider=row.REPLACE_ME, # VARCHAR(16) - # fk_wastewater_networkelement=row.REPLACE_ME, # VARCHAR(16) - # identifier=row.REPLACE_ME, # VARCHAR(20) - # last_modification=row.REPLACE_ME, # TIMESTAMP WITHOUT TIME ZONE - # level=row.REPLACE_ME, # NUMERIC(7, 3) - # obj_id=row.REPLACE_ME, # VARCHAR(16) - # outlet_shape=row.REPLACE_ME, # INTEGER - # position_of_connection=row.REPLACE_ME, # SMALLINT - # remark=row.REPLACE_ME, # VARCHAR(80) - # situation_geometry=row.REPLACE_ME, # geometry(POINTZ,2056) - ) - qgep_session.add(reach_point) - print(".", end="") - print("done") - - print("Importing ABWASSER.abwasserknoten, ABWASSER.metaattribute -> QGEP.wastewater_node") - for row, metaattribute in abwasser_session.query(ABWASSER.abwasserknoten, ABWASSER.metaattribute).join(ABWASSER.metaattribute): - - # baseclass --- abwasserknoten.t_ili_tid, abwasserknoten.t_type - # sia405_baseclass --- abwasserknoten.obj_id - # abwassernetzelement --- abwasserknoten.abwasserbauwerkref, abwasserknoten.bemerkung, abwasserknoten.bezeichnung - # abwasserknoten --- abwasserknoten.lage, abwasserknoten.rueckstaukote, abwasserknoten.sohlenkote, abwasserknoten.t_id - # _bwrel_ --- abwasserknoten.haltung_alternativverlauf__BWREL_t_id, abwasserknoten.haltungspunkt__BWREL_abwassernetzelementref, abwasserknoten.metaattribute__BWREL_sia405_baseclass_metaattribute, abwasserknoten.symbolpos__BWREL_t_id, abwasserknoten.textpos__BWREL_t_id - # _rel_ --- abwasserknoten.abwasserbauwerkref__REL - - # metaattribute --- metaattribute.datenherr, metaattribute.datenlieferant, metaattribute.letzte_aenderung, metaattribute.sia405_baseclass_metaattribute, metaattribute.t_id, metaattribute.t_ili_tid, metaattribute.t_seq - # _rel_ --- metaattribute.sia405_baseclass_metaattribute__REL - - wastewater_node = QGEP.wastewater_node( - - # --- wastewater_networkelement --- - # fk_dataowner=row.REPLACE_ME, # VARCHAR(16) - # fk_provider=row.REPLACE_ME, # VARCHAR(16) - # fk_wastewater_structure=row.REPLACE_ME, # VARCHAR(16) - # identifier=row.REPLACE_ME, # VARCHAR(20) - # last_modification=row.REPLACE_ME, # TIMESTAMP WITHOUT TIME ZONE - # remark=row.REPLACE_ME, # VARCHAR(80) - - # --- wastewater_node --- - # backflow_level=row.REPLACE_ME, # NUMERIC(7, 3) - # bottom_level=row.REPLACE_ME, # NUMERIC(7, 3) - # fk_hydr_geometry=row.REPLACE_ME, # VARCHAR(16) - # obj_id=row.REPLACE_ME, # VARCHAR(16) - # situation_geometry=row.REPLACE_ME, # geometry(POINTZ,2056) - ) - qgep_session.add(wastewater_node) - print(".", end="") - print("done") - - print("Importing ABWASSER.haltung, ABWASSER.metaattribute -> QGEP.reach") - for row, metaattribute in abwasser_session.query(ABWASSER.haltung, ABWASSER.metaattribute).join(ABWASSER.metaattribute): - - # baseclass --- haltung.t_ili_tid, haltung.t_type - # sia405_baseclass --- haltung.obj_id - # abwassernetzelement --- haltung.abwasserbauwerkref, haltung.bemerkung, haltung.bezeichnung - # haltung --- haltung.innenschutz, haltung.laengeeffektiv, haltung.lagebestimmung, haltung.lichte_hoehe, haltung.material, haltung.nachhaltungspunktref, haltung.plangefaelle, haltung.reibungsbeiwert, haltung.reliner_art, haltung.reliner_bautechnik, haltung.reliner_material, haltung.reliner_nennweite, haltung.ringsteifigkeit, haltung.rohrprofilref, haltung.t_id, haltung.verlauf, haltung.vonhaltungspunktref, haltung.wandrauhigkeit - # _bwrel_ --- haltung.haltung_alternativverlauf__BWREL_haltungref, haltung.haltung_alternativverlauf__BWREL_t_id, haltung.haltungspunkt__BWREL_abwassernetzelementref, haltung.metaattribute__BWREL_sia405_baseclass_metaattribute, haltung.sia405_textpos__BWREL_haltungref, haltung.symbolpos__BWREL_t_id, haltung.textpos__BWREL_t_id - # _rel_ --- haltung.abwasserbauwerkref__REL, haltung.nachhaltungspunktref__REL, haltung.rohrprofilref__REL, haltung.vonhaltungspunktref__REL - - # metaattribute --- metaattribute.datenherr, metaattribute.datenlieferant, metaattribute.letzte_aenderung, metaattribute.sia405_baseclass_metaattribute, metaattribute.t_id, metaattribute.t_ili_tid, metaattribute.t_seq - # _rel_ --- metaattribute.sia405_baseclass_metaattribute__REL - - reach = QGEP.reach( - - # --- wastewater_networkelement --- - # fk_dataowner=row.REPLACE_ME, # VARCHAR(16) - # fk_provider=row.REPLACE_ME, # VARCHAR(16) - # fk_wastewater_structure=row.REPLACE_ME, # VARCHAR(16) - # identifier=row.REPLACE_ME, # VARCHAR(20) - # last_modification=row.REPLACE_ME, # TIMESTAMP WITHOUT TIME ZONE - # remark=row.REPLACE_ME, # VARCHAR(80) - - # --- reach --- - # clear_height=row.REPLACE_ME, # INTEGER - # coefficient_of_friction=row.REPLACE_ME, # SMALLINT - # elevation_determination=row.REPLACE_ME, # INTEGER - # fk_pipe_profile=row.REPLACE_ME, # VARCHAR(16) - # fk_reach_point_from=row.REPLACE_ME, # VARCHAR(16) - # fk_reach_point_to=row.REPLACE_ME, # VARCHAR(16) - # horizontal_positioning=row.REPLACE_ME, # INTEGER - # inside_coating=row.REPLACE_ME, # INTEGER - # length_effective=row.REPLACE_ME, # NUMERIC(7, 2) - # material=row.REPLACE_ME, # INTEGER - # obj_id=row.REPLACE_ME, # VARCHAR(16) - # progression_geometry=row.REPLACE_ME, # geometry(COMPOUNDCURVEZ,2056) - # reliner_material=row.REPLACE_ME, # INTEGER - # reliner_nominal_size=row.REPLACE_ME, # INTEGER - # relining_construction=row.REPLACE_ME, # INTEGER - # relining_kind=row.REPLACE_ME, # INTEGER - # ring_stiffness=row.REPLACE_ME, # SMALLINT - # slope_building_plan=row.REPLACE_ME, # SMALLINT - # wall_roughness=row.REPLACE_ME, # NUMERIC(5, 2) - ) - qgep_session.add(reach) - print(".", end="") - print("done") - - print("Importing ABWASSER.trockenwetterfallrohr, ABWASSER.metaattribute -> QGEP.dryweather_downspout") - for row, metaattribute in abwasser_session.query(ABWASSER.trockenwetterfallrohr, ABWASSER.metaattribute).join(ABWASSER.metaattribute): - - # baseclass --- trockenwetterfallrohr.t_ili_tid, trockenwetterfallrohr.t_type - # sia405_baseclass --- trockenwetterfallrohr.obj_id - # bauwerksteil --- trockenwetterfallrohr.abwasserbauwerkref, trockenwetterfallrohr.bemerkung, trockenwetterfallrohr.bezeichnung, trockenwetterfallrohr.instandstellung - # trockenwetterfallrohr --- trockenwetterfallrohr.durchmesser, trockenwetterfallrohr.t_id - # _bwrel_ --- trockenwetterfallrohr.haltung_alternativverlauf__BWREL_t_id, trockenwetterfallrohr.metaattribute__BWREL_sia405_baseclass_metaattribute, trockenwetterfallrohr.symbolpos__BWREL_t_id, trockenwetterfallrohr.textpos__BWREL_t_id - # _rel_ --- trockenwetterfallrohr.abwasserbauwerkref__REL - - # metaattribute --- metaattribute.datenherr, metaattribute.datenlieferant, metaattribute.letzte_aenderung, metaattribute.sia405_baseclass_metaattribute, metaattribute.t_id, metaattribute.t_ili_tid, metaattribute.t_seq - # _rel_ --- metaattribute.sia405_baseclass_metaattribute__REL - - dryweather_downspout = QGEP.dryweather_downspout( - - # --- structure_part --- - # fk_dataowner=row.REPLACE_ME, # VARCHAR(16) - # fk_provider=row.REPLACE_ME, # VARCHAR(16) - # fk_wastewater_structure=row.REPLACE_ME, # VARCHAR(16) - # identifier=row.REPLACE_ME, # VARCHAR(20) - # last_modification=row.REPLACE_ME, # TIMESTAMP WITHOUT TIME ZONE - # remark=row.REPLACE_ME, # VARCHAR(80) - # renovation_demand=row.REPLACE_ME, # INTEGER - - # --- dryweather_downspout --- - # diameter=row.REPLACE_ME, # SMALLINT - # obj_id=row.REPLACE_ME, # VARCHAR(16) - ) - qgep_session.add(dryweather_downspout) - print(".", end="") - print("done") - - print("Importing ABWASSER.einstiegshilfe, ABWASSER.metaattribute -> QGEP.access_aid") - for row, metaattribute in abwasser_session.query(ABWASSER.einstiegshilfe, ABWASSER.metaattribute).join(ABWASSER.metaattribute): - - # baseclass --- einstiegshilfe.t_ili_tid, einstiegshilfe.t_type - # sia405_baseclass --- einstiegshilfe.obj_id - # bauwerksteil --- einstiegshilfe.abwasserbauwerkref, einstiegshilfe.bemerkung, einstiegshilfe.bezeichnung, einstiegshilfe.instandstellung - # einstiegshilfe --- einstiegshilfe.art, einstiegshilfe.t_id - # _bwrel_ --- einstiegshilfe.haltung_alternativverlauf__BWREL_t_id, einstiegshilfe.metaattribute__BWREL_sia405_baseclass_metaattribute, einstiegshilfe.symbolpos__BWREL_t_id, einstiegshilfe.textpos__BWREL_t_id - # _rel_ --- einstiegshilfe.abwasserbauwerkref__REL - - # metaattribute --- metaattribute.datenherr, metaattribute.datenlieferant, metaattribute.letzte_aenderung, metaattribute.sia405_baseclass_metaattribute, metaattribute.t_id, metaattribute.t_ili_tid, metaattribute.t_seq - # _rel_ --- metaattribute.sia405_baseclass_metaattribute__REL - - access_aid = QGEP.access_aid( - - # --- structure_part --- - # fk_dataowner=row.REPLACE_ME, # VARCHAR(16) - # fk_provider=row.REPLACE_ME, # VARCHAR(16) - # fk_wastewater_structure=row.REPLACE_ME, # VARCHAR(16) - # identifier=row.REPLACE_ME, # VARCHAR(20) - # last_modification=row.REPLACE_ME, # TIMESTAMP WITHOUT TIME ZONE - # remark=row.REPLACE_ME, # VARCHAR(80) - # renovation_demand=row.REPLACE_ME, # INTEGER - - # --- access_aid --- - # kind=row.REPLACE_ME, # INTEGER - # obj_id=row.REPLACE_ME, # VARCHAR(16) - ) - qgep_session.add(access_aid) - print(".", end="") - print("done") - - print("Importing ABWASSER.trockenwetterrinne, ABWASSER.metaattribute -> QGEP.dryweather_flume") - for row, metaattribute in abwasser_session.query(ABWASSER.trockenwetterrinne, ABWASSER.metaattribute).join(ABWASSER.metaattribute): - - # baseclass --- trockenwetterrinne.t_ili_tid, trockenwetterrinne.t_type - # sia405_baseclass --- trockenwetterrinne.obj_id - # bauwerksteil --- trockenwetterrinne.abwasserbauwerkref, trockenwetterrinne.bemerkung, trockenwetterrinne.bezeichnung, trockenwetterrinne.instandstellung - # trockenwetterrinne --- trockenwetterrinne.material, trockenwetterrinne.t_id - # _bwrel_ --- trockenwetterrinne.haltung_alternativverlauf__BWREL_t_id, trockenwetterrinne.metaattribute__BWREL_sia405_baseclass_metaattribute, trockenwetterrinne.symbolpos__BWREL_t_id, trockenwetterrinne.textpos__BWREL_t_id - # _rel_ --- trockenwetterrinne.abwasserbauwerkref__REL - - # metaattribute --- metaattribute.datenherr, metaattribute.datenlieferant, metaattribute.letzte_aenderung, metaattribute.sia405_baseclass_metaattribute, metaattribute.t_id, metaattribute.t_ili_tid, metaattribute.t_seq - # _rel_ --- metaattribute.sia405_baseclass_metaattribute__REL - - dryweather_flume = QGEP.dryweather_flume( - - # --- structure_part --- - # fk_dataowner=row.REPLACE_ME, # VARCHAR(16) - # fk_provider=row.REPLACE_ME, # VARCHAR(16) - # fk_wastewater_structure=row.REPLACE_ME, # VARCHAR(16) - # identifier=row.REPLACE_ME, # VARCHAR(20) - # last_modification=row.REPLACE_ME, # TIMESTAMP WITHOUT TIME ZONE - # remark=row.REPLACE_ME, # VARCHAR(80) - # renovation_demand=row.REPLACE_ME, # INTEGER - - # --- dryweather_flume --- - # material=row.REPLACE_ME, # INTEGER - # obj_id=row.REPLACE_ME, # VARCHAR(16) - ) - qgep_session.add(dryweather_flume) - print(".", end="") - print("done") - - print("Importing ABWASSER.deckel, ABWASSER.metaattribute -> QGEP.cover") - for row, metaattribute in abwasser_session.query(ABWASSER.deckel, ABWASSER.metaattribute).join(ABWASSER.metaattribute): - - # baseclass --- deckel.t_ili_tid, deckel.t_type - # sia405_baseclass --- deckel.obj_id - # bauwerksteil --- deckel.abwasserbauwerkref, deckel.bemerkung, deckel.bezeichnung, deckel.instandstellung - # deckel --- deckel.deckelform, deckel.durchmesser, deckel.entlueftung, deckel.fabrikat, deckel.kote, deckel.lage, deckel.lagegenauigkeit, deckel.material, deckel.schlammeimer, deckel.t_id, deckel.verschluss - # _bwrel_ --- deckel.haltung_alternativverlauf__BWREL_t_id, deckel.metaattribute__BWREL_sia405_baseclass_metaattribute, deckel.symbolpos__BWREL_t_id, deckel.textpos__BWREL_t_id - # _rel_ --- deckel.abwasserbauwerkref__REL - - # metaattribute --- metaattribute.datenherr, metaattribute.datenlieferant, metaattribute.letzte_aenderung, metaattribute.sia405_baseclass_metaattribute, metaattribute.t_id, metaattribute.t_ili_tid, metaattribute.t_seq - # _rel_ --- metaattribute.sia405_baseclass_metaattribute__REL - - cover = QGEP.cover( - - # --- structure_part --- - # fk_dataowner=row.REPLACE_ME, # VARCHAR(16) - # fk_provider=row.REPLACE_ME, # VARCHAR(16) - # fk_wastewater_structure=row.REPLACE_ME, # VARCHAR(16) - # identifier=row.REPLACE_ME, # VARCHAR(20) - # last_modification=row.REPLACE_ME, # TIMESTAMP WITHOUT TIME ZONE - # remark=row.REPLACE_ME, # VARCHAR(80) - # renovation_demand=row.REPLACE_ME, # INTEGER - - # --- cover --- - # brand=row.REPLACE_ME, # VARCHAR(50) - # cover_shape=row.REPLACE_ME, # INTEGER - # diameter=row.REPLACE_ME, # SMALLINT - # fastening=row.REPLACE_ME, # INTEGER - # level=row.REPLACE_ME, # NUMERIC(7, 3) - # material=row.REPLACE_ME, # INTEGER - # obj_id=row.REPLACE_ME, # VARCHAR(16) - # positional_accuracy=row.REPLACE_ME, # INTEGER - # situation_geometry=row.REPLACE_ME, # geometry(POINTZ,2056) - # sludge_bucket=row.REPLACE_ME, # INTEGER - # venting=row.REPLACE_ME, # INTEGER - ) - qgep_session.add(cover) - print(".", end="") - print("done") - - print("Importing ABWASSER.bankett, ABWASSER.metaattribute -> QGEP.benching") - for row, metaattribute in abwasser_session.query(ABWASSER.bankett, ABWASSER.metaattribute).join(ABWASSER.metaattribute): - - # baseclass --- bankett.t_ili_tid, bankett.t_type - # sia405_baseclass --- bankett.obj_id - # bauwerksteil --- bankett.abwasserbauwerkref, bankett.bemerkung, bankett.bezeichnung, bankett.instandstellung - # bankett --- bankett.art, bankett.t_id - # _bwrel_ --- bankett.haltung_alternativverlauf__BWREL_t_id, bankett.metaattribute__BWREL_sia405_baseclass_metaattribute, bankett.symbolpos__BWREL_t_id, bankett.textpos__BWREL_t_id - # _rel_ --- bankett.abwasserbauwerkref__REL - - # metaattribute --- metaattribute.datenherr, metaattribute.datenlieferant, metaattribute.letzte_aenderung, metaattribute.sia405_baseclass_metaattribute, metaattribute.t_id, metaattribute.t_ili_tid, metaattribute.t_seq - # _rel_ --- metaattribute.sia405_baseclass_metaattribute__REL - - benching = QGEP.benching( - - # --- structure_part --- - # fk_dataowner=row.REPLACE_ME, # VARCHAR(16) - # fk_provider=row.REPLACE_ME, # VARCHAR(16) - # fk_wastewater_structure=row.REPLACE_ME, # VARCHAR(16) - # identifier=row.REPLACE_ME, # VARCHAR(20) - # last_modification=row.REPLACE_ME, # TIMESTAMP WITHOUT TIME ZONE - # remark=row.REPLACE_ME, # VARCHAR(80) - # renovation_demand=row.REPLACE_ME, # INTEGER - - # --- benching --- - # kind=row.REPLACE_ME, # INTEGER - # obj_id=row.REPLACE_ME, # VARCHAR(16) - ) - qgep_session.add(benching) - print(".", end="") - print("done") - - print("Importing ABWASSER.untersuchung, ABWASSER.metaattribute -> QGEP.examination") - for row, metaattribute in abwasser_session.query(ABWASSER.untersuchung, ABWASSER.metaattribute).join(ABWASSER.metaattribute): - - # baseclass --- untersuchung.t_ili_tid, untersuchung.t_type - # sia405_baseclass --- untersuchung.obj_id - # erhaltungsereignis --- untersuchung.abwasserbauwerkref, untersuchung.art, untersuchung.astatus, untersuchung.ausfuehrende_firmaref, untersuchung.ausfuehrender, untersuchung.bemerkung, untersuchung.bezeichnung, untersuchung.datengrundlage, untersuchung.dauer, untersuchung.detaildaten, untersuchung.ergebnis, untersuchung.grund, untersuchung.kosten, untersuchung.zeitpunkt - # untersuchung --- untersuchung.bispunktbezeichnung, untersuchung.erfassungsart, untersuchung.fahrzeug, untersuchung.geraet, untersuchung.haltungspunktref, untersuchung.inspizierte_laenge, untersuchung.t_id, untersuchung.videonummer, untersuchung.vonpunktbezeichnung, untersuchung.witterung - # _bwrel_ --- untersuchung.haltung_alternativverlauf__BWREL_t_id, untersuchung.metaattribute__BWREL_sia405_baseclass_metaattribute, untersuchung.schaden__BWREL_untersuchungref, untersuchung.symbolpos__BWREL_t_id, untersuchung.textpos__BWREL_t_id - # _rel_ --- untersuchung.abwasserbauwerkref__REL, untersuchung.ausfuehrende_firmaref__REL, untersuchung.haltungspunktref__REL - - # metaattribute --- metaattribute.datenherr, metaattribute.datenlieferant, metaattribute.letzte_aenderung, metaattribute.sia405_baseclass_metaattribute, metaattribute.t_id, metaattribute.t_ili_tid, metaattribute.t_seq - # _rel_ --- metaattribute.sia405_baseclass_metaattribute__REL - - examination = QGEP.examination( - - # --- maintenance_event --- - # active_zone=row.REPLACE_ME, # VARCHAR(1) - # base_data=row.REPLACE_ME, # TEXT - # cost=row.REPLACE_ME, # NUMERIC(10, 2) - # data_details=row.REPLACE_ME, # VARCHAR(50) - # duration=row.REPLACE_ME, # SMALLINT - # fk_dataowner=row.REPLACE_ME, # VARCHAR(16) - # fk_operating_company=row.REPLACE_ME, # VARCHAR(16) - # fk_provider=row.REPLACE_ME, # VARCHAR(16) - # identifier=row.REPLACE_ME, # VARCHAR(20) - # kind=row.REPLACE_ME, # INTEGER - # last_modification=row.REPLACE_ME, # TIMESTAMP WITHOUT TIME ZONE - # operator=row.REPLACE_ME, # VARCHAR(50) - # reason=row.REPLACE_ME, # VARCHAR(50) - # remark=row.REPLACE_ME, # VARCHAR(80) - # result=row.REPLACE_ME, # VARCHAR(50) - # status=row.REPLACE_ME, # INTEGER - # time_point=row.REPLACE_ME, # TIMESTAMP WITHOUT TIME ZONE - - # --- examination --- - # equipment=row.REPLACE_ME, # VARCHAR(50) - # fk_reach_point=row.REPLACE_ME, # VARCHAR(16) - # from_point_identifier=row.REPLACE_ME, # VARCHAR(41) - # inspected_length=row.REPLACE_ME, # NUMERIC(7, 2) - # obj_id=row.REPLACE_ME, # VARCHAR(16) - # recording_type=row.REPLACE_ME, # INTEGER - # to_point_identifier=row.REPLACE_ME, # VARCHAR(41) - # vehicle=row.REPLACE_ME, # VARCHAR(50) - # videonumber=row.REPLACE_ME, # VARCHAR(41) - # weather=row.REPLACE_ME, # INTEGER - ) - qgep_session.add(examination) - print(".", end="") - print("done") - - print("Importing ABWASSER.normschachtschaden, ABWASSER.metaattribute -> QGEP.damage_manhole") - for row, metaattribute in abwasser_session.query(ABWASSER.normschachtschaden, ABWASSER.metaattribute).join(ABWASSER.metaattribute): - - # baseclass --- normschachtschaden.t_ili_tid, normschachtschaden.t_type - # sia405_baseclass --- normschachtschaden.obj_id - # schaden --- normschachtschaden.anmerkung, normschachtschaden.ansichtsparameter, normschachtschaden.einzelschadenklasse, normschachtschaden.streckenschaden, normschachtschaden.untersuchungref, normschachtschaden.verbindung, normschachtschaden.videozaehlerstand - # normschachtschaden --- normschachtschaden.distanz, normschachtschaden.quantifizierung1, normschachtschaden.quantifizierung2, normschachtschaden.schachtbereich, normschachtschaden.schachtschadencode, normschachtschaden.schadenlageanfang, normschachtschaden.schadenlageende, normschachtschaden.t_id - # _bwrel_ --- normschachtschaden.haltung_alternativverlauf__BWREL_t_id, normschachtschaden.metaattribute__BWREL_sia405_baseclass_metaattribute, normschachtschaden.symbolpos__BWREL_t_id, normschachtschaden.textpos__BWREL_t_id - # _rel_ --- normschachtschaden.untersuchungref__REL - - # metaattribute --- metaattribute.datenherr, metaattribute.datenlieferant, metaattribute.letzte_aenderung, metaattribute.sia405_baseclass_metaattribute, metaattribute.t_id, metaattribute.t_ili_tid, metaattribute.t_seq - # _rel_ --- metaattribute.sia405_baseclass_metaattribute__REL - - damage_manhole = QGEP.damage_manhole( - - # --- damage --- - # comments=row.REPLACE_ME, # VARCHAR(100) - # connection=row.REPLACE_ME, # INTEGER - # damage_begin=row.REPLACE_ME, # SMALLINT - # damage_end=row.REPLACE_ME, # SMALLINT - # damage_reach=row.REPLACE_ME, # VARCHAR(3) - # distance=row.REPLACE_ME, # NUMERIC(7, 2) - # fk_dataowner=row.REPLACE_ME, # VARCHAR(16) - # fk_examination=row.REPLACE_ME, # VARCHAR(16) - # fk_provider=row.REPLACE_ME, # VARCHAR(16) - # last_modification=row.REPLACE_ME, # TIMESTAMP WITHOUT TIME ZONE - # quantification1=row.REPLACE_ME, # INTEGER - # quantification2=row.REPLACE_ME, # INTEGER - # single_damage_class=row.REPLACE_ME, # INTEGER - # video_counter=row.REPLACE_ME, # VARCHAR(11) - # view_parameters=row.REPLACE_ME, # VARCHAR(200) - - # --- damage_manhole --- - # manhole_damage_code=row.REPLACE_ME, # INTEGER - # manhole_shaft_area=row.REPLACE_ME, # INTEGER - # obj_id=row.REPLACE_ME, # VARCHAR(16) - ) - qgep_session.add(damage_manhole) - print(".", end="") - print("done") - - print("Importing ABWASSER.kanalschaden, ABWASSER.metaattribute -> QGEP.damage_channel") - for row, metaattribute in abwasser_session.query(ABWASSER.kanalschaden, ABWASSER.metaattribute).join(ABWASSER.metaattribute): - - # baseclass --- kanalschaden.t_ili_tid, kanalschaden.t_type - # sia405_baseclass --- kanalschaden.obj_id - # schaden --- kanalschaden.anmerkung, kanalschaden.ansichtsparameter, kanalschaden.einzelschadenklasse, kanalschaden.streckenschaden, kanalschaden.untersuchungref, kanalschaden.verbindung, kanalschaden.videozaehlerstand - # kanalschaden --- kanalschaden.distanz, kanalschaden.kanalschadencode, kanalschaden.quantifizierung1, kanalschaden.quantifizierung2, kanalschaden.schadenlageanfang, kanalschaden.schadenlageende, kanalschaden.t_id - # _bwrel_ --- kanalschaden.haltung_alternativverlauf__BWREL_t_id, kanalschaden.metaattribute__BWREL_sia405_baseclass_metaattribute, kanalschaden.symbolpos__BWREL_t_id, kanalschaden.textpos__BWREL_t_id - # _rel_ --- kanalschaden.untersuchungref__REL - - # metaattribute --- metaattribute.datenherr, metaattribute.datenlieferant, metaattribute.letzte_aenderung, metaattribute.sia405_baseclass_metaattribute, metaattribute.t_id, metaattribute.t_ili_tid, metaattribute.t_seq - # _rel_ --- metaattribute.sia405_baseclass_metaattribute__REL - - damage_channel = QGEP.damage_channel( - - # --- damage --- - # comments=row.REPLACE_ME, # VARCHAR(100) - # connection=row.REPLACE_ME, # INTEGER - # damage_begin=row.REPLACE_ME, # SMALLINT - # damage_end=row.REPLACE_ME, # SMALLINT - # damage_reach=row.REPLACE_ME, # VARCHAR(3) - # distance=row.REPLACE_ME, # NUMERIC(7, 2) - # fk_dataowner=row.REPLACE_ME, # VARCHAR(16) - # fk_examination=row.REPLACE_ME, # VARCHAR(16) - # fk_provider=row.REPLACE_ME, # VARCHAR(16) - # last_modification=row.REPLACE_ME, # TIMESTAMP WITHOUT TIME ZONE - # quantification1=row.REPLACE_ME, # INTEGER - # quantification2=row.REPLACE_ME, # INTEGER - # single_damage_class=row.REPLACE_ME, # INTEGER - # video_counter=row.REPLACE_ME, # VARCHAR(11) - # view_parameters=row.REPLACE_ME, # VARCHAR(200) - - # --- damage_channel --- - # channel_damage_code=row.REPLACE_ME, # INTEGER - # obj_id=row.REPLACE_ME, # VARCHAR(16) - ) - qgep_session.add(damage_channel) - print(".", end="") - print("done") - - print("Importing ABWASSER.datentraeger, ABWASSER.metaattribute -> QGEP.data_media") - for row, metaattribute in abwasser_session.query(ABWASSER.datentraeger, ABWASSER.metaattribute).join(ABWASSER.metaattribute): - - # baseclass --- datentraeger.t_ili_tid, datentraeger.t_type - # sia405_baseclass --- datentraeger.obj_id - # datentraeger --- datentraeger.art, datentraeger.bemerkung, datentraeger.bezeichnung, datentraeger.pfad, datentraeger.standort, datentraeger.t_id - # _bwrel_ --- datentraeger.datei__BWREL_datentraegerref, datentraeger.haltung_alternativverlauf__BWREL_t_id, datentraeger.metaattribute__BWREL_sia405_baseclass_metaattribute, datentraeger.symbolpos__BWREL_t_id, datentraeger.textpos__BWREL_t_id - - # metaattribute --- metaattribute.datenherr, metaattribute.datenlieferant, metaattribute.letzte_aenderung, metaattribute.sia405_baseclass_metaattribute, metaattribute.t_id, metaattribute.t_ili_tid, metaattribute.t_seq - # _rel_ --- metaattribute.sia405_baseclass_metaattribute__REL - - data_media = QGEP.data_media( - - # --- data_media --- - # fk_dataowner=row.REPLACE_ME, # VARCHAR(16) - # fk_provider=row.REPLACE_ME, # VARCHAR(16) - # identifier=row.REPLACE_ME, # VARCHAR(40) - # kind=row.REPLACE_ME, # INTEGER - # last_modification=row.REPLACE_ME, # TIMESTAMP WITHOUT TIME ZONE - # location=row.REPLACE_ME, # VARCHAR(50) - # obj_id=row.REPLACE_ME, # VARCHAR(16) - # path=row.REPLACE_ME, # VARCHAR(100) - # remark=row.REPLACE_ME, # VARCHAR(80) - ) - qgep_session.add(data_media) - print(".", end="") - print("done") - - print("Importing ABWASSER.datei, ABWASSER.metaattribute -> QGEP.file") - for row, metaattribute in abwasser_session.query(ABWASSER.datei, ABWASSER.metaattribute).join(ABWASSER.metaattribute): - - # baseclass --- datei.t_ili_tid, datei.t_type - # sia405_baseclass --- datei.obj_id - # datei --- datei.art, datei.bemerkung, datei.bezeichnung, datei.datentraegerref, datei.klasse, datei.objekt, datei.relativpfad, datei.t_id - # _bwrel_ --- datei.haltung_alternativverlauf__BWREL_t_id, datei.metaattribute__BWREL_sia405_baseclass_metaattribute, datei.symbolpos__BWREL_t_id, datei.textpos__BWREL_t_id - # _rel_ --- datei.datentraegerref__REL - - # metaattribute --- metaattribute.datenherr, metaattribute.datenlieferant, metaattribute.letzte_aenderung, metaattribute.sia405_baseclass_metaattribute, metaattribute.t_id, metaattribute.t_ili_tid, metaattribute.t_seq - # _rel_ --- metaattribute.sia405_baseclass_metaattribute__REL - - file = QGEP.file( - - # --- file --- - # class=row.REPLACE_ME, # INTEGER - # fk_data_media=row.REPLACE_ME, # VARCHAR(16) - # fk_dataowner=row.REPLACE_ME, # VARCHAR(16) - # fk_provider=row.REPLACE_ME, # VARCHAR(16) - # identifier=row.REPLACE_ME, # VARCHAR(60) - # kind=row.REPLACE_ME, # INTEGER - # last_modification=row.REPLACE_ME, # TIMESTAMP WITHOUT TIME ZONE - # obj_id=row.REPLACE_ME, # VARCHAR(16) - # object=row.REPLACE_ME, # VARCHAR(41) - # path_relative=row.REPLACE_ME, # VARCHAR(200) - # remark=row.REPLACE_ME, # VARCHAR(80) - ) - qgep_session.add(file) - print(".", end="") - print("done") - - qgep_session.commit() - - qgep_session.close() - abwasser_session.close() diff --git a/qgepqwat2ili/qgepdss/export.py b/qgepqwat2ili/qgepdss/export.py index c7c6b0bd..6bcfe72e 100644 --- a/qgepqwat2ili/qgepdss/export.py +++ b/qgepqwat2ili/qgepdss/export.py @@ -14,7 +14,7 @@ from .model_qgep import get_qgep_model -def qgep_export(selection=None, labels_file=None, orientation=None, basket_enabled=False): +def qgep_export_dss(selection=None, labels_file=None, orientation=None, basket_enabled=False): """ Export data from the QGEP model into the ili2pg model. @@ -22,8 +22,8 @@ def qgep_export(selection=None, labels_file=None, orientation=None, basket_enabl selection: if provided, limits the export to networkelements that are provided in the selection """ - QGEP = get_qgep_model() - ABWASSER = get_abwasser_model() + qgep_model = get_qgep_model() + abwasser_model = get_abwasser_model() # Logging disabled (very slow) # qgep_session = Session(utils.sqlalchemy.create_engine(logger_name="qgep"), autocommit=False, autoflush=False) @@ -38,7 +38,7 @@ def qgep_export(selection=None, labels_file=None, orientation=None, basket_enabl basket_utils = None current_basket = None if basket_enabled: - basket_utils = BasketUtils(ABWASSER, abwasser_session) + basket_utils = BasketUtils(abwasser_model, abwasser_session) basket_utils.create_basket() current_basket = basket_utils.basket_topic_sia405_abwasser @@ -74,8 +74,12 @@ def qgep_export(selection=None, labels_file=None, orientation=None, basket_enabl tid_maker=tid_maker, current_basket=current_basket, abwasser_session=abwasser_session, - abwasser_model=ABWASSER, + abwasser_model=abwasser_model, + qgep_session=qgep_session, + qgep_model=qgep_model, labelorientation=labelorientation, + filtered=filtered, + subset_ids=subset_ids, ) def organisation_common(row): @@ -190,10 +194,10 @@ def overflow_common(row): # re_maintenance_event_wastewater_structure moved to end, as wastewater_structure and maintenance_event are not yet added logger.info("Exporting QGEP.mutation -> ABWASSER.mutation, ABWASSER.metaattribute") - query = qgep_session.query(QGEP.mutation) + query = qgep_session.query(qgep_model.mutation) # only export explicitly specified mutation objects if filtered if filtered: - query = query.filter(QGEP.mutation.obj_id.in_(subset_ids)) + query = query.filter(qgep_model.mutation.obj_id.in_(subset_ids)) for row in query: # AVAILABLE FIELDS IN QGEP.mutation @@ -206,7 +210,7 @@ def overflow_common(row): # --- _rel_ --- # to do add relations fk_dataowner__REL, fk_provider__REL, profile_type__REL - mutation = ABWASSER.mutation( + mutation = abwasser_model.mutation( # FIELDS TO MAP TO ABWASSER.mutation # --- baseclass --- # --- sia405_baseclass --- @@ -234,7 +238,7 @@ def overflow_common(row): abwasser_session.flush() logger.info("Exporting QGEP.aquifier -> ABWASSER.grundwasserleiter, ABWASSER.metaattribute") - query = qgep_session.query(QGEP.aquifier) + query = qgep_session.query(qgep_model.aquifier) # always export all aquifier for row in query: @@ -248,7 +252,7 @@ def overflow_common(row): # --- _rel_ --- # to do add relations fk_dataowner__REL, fk_provider__REL, profile_type__REL - grundwasserleiter = ABWASSER.grundwasserleiter( + grundwasserleiter = abwasser_model.grundwasserleiter( # FIELDS TO MAP TO ABWASSER.grundwasserleiter # --- baseclass --- # --- sia405_baseclass --- @@ -270,7 +274,7 @@ def overflow_common(row): abwasser_session.flush() logger.info("Exporting QGEP.river -> ABWASSER.fliessgewaesser, ABWASSER.metaattribute") - query = qgep_session.query(QGEP.river) + query = qgep_session.query(qgep_model.river) # always export all river for row in query: # AVAILABLE FIELDS IN QGEP.river @@ -287,7 +291,7 @@ def overflow_common(row): # --- _rel_ --- # to do extra funktion schreiben wo alle fk auf diese klasse erzeugt werden z.B. # accessibility__REL, bedding_encasement__REL, - fliessgewaesser = ABWASSER.fliessgewaesser( + fliessgewaesser = abwasser_model.fliessgewaesser( # FIELDS TO MAP TO ABWASSER.fliessgewaesser # --- baseclass --- # --- sia405_baseclass --- @@ -304,7 +308,7 @@ def overflow_common(row): abwasser_session.flush() logger.info("Exporting QGEP.lake -> ABWASSER.see, ABWASSER.metaattribute") - query = qgep_session.query(QGEP.lake) + query = qgep_session.query(qgep_model.lake) # always export all lake for row in query: # AVAILABLE FIELDS IN QGEP.lake @@ -321,7 +325,7 @@ def overflow_common(row): # --- _rel_ --- # to do extra funktion schreiben wo alle fk auf diese klasse erzeugt werden z.B. # accessibility__REL, bedding_encasement__REL, - see = ABWASSER.see( + see = abwasser_model.see( # FIELDS TO MAP TO ABWASSER.see # --- baseclass --- # --- sia405_baseclass --- @@ -340,7 +344,7 @@ def overflow_common(row): logger.info( "Exporting QGEP.water_course_segment -> ABWASSER.gewaesserabschnitt, ABWASSER.metaattribute" ) - query = qgep_session.query(QGEP.water_course_segment) + query = qgep_session.query(qgep_model.water_course_segment) # always export all water_course_segment for row in query: @@ -354,7 +358,7 @@ def overflow_common(row): # --- _rel_ --- # to do add relations fk_dataowner__REL, fk_provider__REL, profile_type__REL - gewaesserabschnitt = ABWASSER.gewaesserabschnitt( + gewaesserabschnitt = abwasser_model.gewaesserabschnitt( # FIELDS TO MAP TO ABWASSER.gewaesserabschnitt # --- baseclass --- # --- sia405_baseclass --- @@ -391,7 +395,7 @@ def overflow_common(row): abwasser_session.flush() logger.info("Exporting QGEP.water_catchment -> ABWASSER.wasserfassung, ABWASSER.metaattribute") - query = qgep_session.query(QGEP.water_catchment) + query = qgep_session.query(qgep_model.water_catchment) # always export all water_catchment for row in query: @@ -405,7 +409,7 @@ def overflow_common(row): # --- _rel_ --- # to do add relations fk_dataowner__REL, fk_provider__REL, profile_type__REL - wasserfassung = ABWASSER.wasserfassung( + wasserfassung = abwasser_model.wasserfassung( # FIELDS TO MAP TO ABWASSER.wasserfassung # --- baseclass --- # --- sia405_baseclass --- @@ -428,7 +432,7 @@ def overflow_common(row): logger.info("Exporting QGEP.river_bank -> ABWASSER.ufer, ABWASSER.metaattribute") # always export all river_bank - query = qgep_session.query(QGEP.river_bank) + query = qgep_session.query(qgep_model.river_bank) for row in query: # AVAILABLE FIELDS IN QGEP.river_bank @@ -441,7 +445,7 @@ def overflow_common(row): # --- _rel_ --- # to do add relations fk_dataowner__REL, fk_provider__REL, profile_type__REL - ufer = ABWASSER.ufer( + ufer = abwasser_model.ufer( # FIELDS TO MAP TO ABWASSER.ufer # --- baseclass --- # --- sia405_baseclass --- @@ -467,7 +471,7 @@ def overflow_common(row): abwasser_session.flush() logger.info("Exporting QGEP.river_bed -> ABWASSER.gewaessersohle, ABWASSER.metaattribute") - query = qgep_session.query(QGEP.river_bed) + query = qgep_session.query(qgep_model.river_bed) # always export all river_bed for row in query: @@ -481,7 +485,7 @@ def overflow_common(row): # --- _rel_ --- # to do add relations fk_dataowner__REL, fk_provider__REL, profile_type__REL - gewaessersohle = ABWASSER.gewaessersohle( + gewaessersohle = abwasser_model.gewaessersohle( # FIELDS TO MAP TO ABWASSER.gewaessersohle # --- baseclass --- # --- sia405_baseclass --- @@ -506,7 +510,7 @@ def overflow_common(row): logger.info( "Exporting QGEP.sector_water_body -> ABWASSER.gewaessersektor, ABWASSER.metaattribute" ) - query = qgep_session.query(QGEP.sector_water_body) + query = qgep_session.query(qgep_model.sector_water_body) # always export all sector_water_body for row in query: @@ -520,7 +524,7 @@ def overflow_common(row): # --- _rel_ --- # to do add relations fk_dataowner__REL, fk_provider__REL, profile_type__REL - gewaessersektor = ABWASSER.gewaessersektor( + gewaessersektor = abwasser_model.gewaessersektor( # FIELDS TO MAP TO ABWASSER.gewaessersektor # --- baseclass --- # --- sia405_baseclass --- @@ -547,7 +551,7 @@ def overflow_common(row): abwasser_session.flush() logger.info("Exporting QGEP.administrative_office -> ABWASSER.amt, ABWASSER.metaattribute") - query = qgep_session.query(QGEP.administrative_office) + query = qgep_session.query(qgep_model.administrative_office) # always export all administrative_office for row in query: # AVAILABLE FIELDS IN QGEP.administrative_office @@ -564,7 +568,7 @@ def overflow_common(row): # --- _rel_ --- # to do extra funktion schreiben wo alle fk auf diese klasse erzeugt werden z.B. # accessibility__REL, bedding_encasement__REL, - amt = ABWASSER.amt( + amt = abwasser_model.amt( # FIELDS TO MAP TO ABWASSER.amt # --- baseclass --- # --- sia405_baseclass --- @@ -582,7 +586,7 @@ def overflow_common(row): logger.info( "Exporting QGEP.cooperative -> ABWASSER.genossenschaft_korporation, ABWASSER.metaattribute" ) - query = qgep_session.query(QGEP.cooperative) + query = qgep_session.query(qgep_model.cooperative) # always export all cooperative for row in query: # AVAILABLE FIELDS IN QGEP.cooperative @@ -599,7 +603,7 @@ def overflow_common(row): # --- _rel_ --- # to do extra funktion schreiben wo alle fk auf diese klasse erzeugt werden z.B. # accessibility__REL, bedding_encasement__REL, - genossenschaft_korporation = ABWASSER.genossenschaft_korporation( + genossenschaft_korporation = abwasser_model.genossenschaft_korporation( # FIELDS TO MAP TO ABWASSER.genossenschaft_korporation # --- baseclass --- # --- sia405_baseclass --- @@ -615,7 +619,7 @@ def overflow_common(row): abwasser_session.flush() logger.info("Exporting QGEP.canton -> ABWASSER.kanton, ABWASSER.metaattribute") - query = qgep_session.query(QGEP.canton) + query = qgep_session.query(qgep_model.canton) # always export all canton for row in query: # AVAILABLE FIELDS IN QGEP.canton @@ -632,7 +636,7 @@ def overflow_common(row): # --- _rel_ --- # to do extra funktion schreiben wo alle fk auf diese klasse erzeugt werden z.B. # accessibility__REL, bedding_encasement__REL, - kanton = ABWASSER.kanton( + kanton = abwasser_model.kanton( # FIELDS TO MAP TO ABWASSER.kanton # --- baseclass --- # --- sia405_baseclass --- @@ -651,7 +655,7 @@ def overflow_common(row): logger.info( "Exporting QGEP.waste_water_association -> ABWASSER.abwasserverband, ABWASSER.metaattribute" ) - query = qgep_session.query(QGEP.waste_water_association) + query = qgep_session.query(qgep_model.waste_water_association) # always export all waste_water_association for row in query: # AVAILABLE FIELDS IN QGEP.waste_water_association @@ -668,7 +672,7 @@ def overflow_common(row): # --- _rel_ --- # to do extra funktion schreiben wo alle fk auf diese klasse erzeugt werden z.B. # accessibility__REL, bedding_encasement__REL, - abwasserverband = ABWASSER.abwasserverband( + abwasserverband = abwasser_model.abwasserverband( # FIELDS TO MAP TO ABWASSER.abwasserverband # --- baseclass --- # --- sia405_baseclass --- @@ -684,7 +688,7 @@ def overflow_common(row): abwasser_session.flush() logger.info("Exporting QGEP.municipality -> ABWASSER.gemeinde, ABWASSER.metaattribute") - query = qgep_session.query(QGEP.municipality) + query = qgep_session.query(qgep_model.municipality) # always export all municipality for row in query: # AVAILABLE FIELDS IN QGEP.municipality @@ -701,7 +705,7 @@ def overflow_common(row): # --- _rel_ --- # to do extra funktion schreiben wo alle fk auf diese klasse erzeugt werden z.B. # accessibility__REL, bedding_encasement__REL, - gemeinde = ABWASSER.gemeinde( + gemeinde = abwasser_model.gemeinde( # FIELDS TO MAP TO ABWASSER.gemeinde # --- baseclass --- # --- sia405_baseclass --- @@ -725,7 +729,7 @@ def overflow_common(row): logger.info( "Exporting QGEP.waste_water_treatment_plant -> ABWASSER.abwasserreinigungsanlage, ABWASSER.metaattribute" ) - query = qgep_session.query(QGEP.waste_water_treatment_plant) + query = qgep_session.query(qgep_model.waste_water_treatment_plant) # always export all waste_water_treatment_plant for row in query: # AVAILABLE FIELDS IN QGEP.waste_water_treatment_plant @@ -742,7 +746,7 @@ def overflow_common(row): # --- _rel_ --- # to do extra funktion schreiben wo alle fk auf diese klasse erzeugt werden z.B. # accessibility__REL, bedding_encasement__REL, - abwasserreinigungsanlage = ABWASSER.abwasserreinigungsanlage( + abwasserreinigungsanlage = abwasser_model.abwasserreinigungsanlage( # FIELDS TO MAP TO ABWASSER.abwasserreinigungsanlage # --- baseclass --- # --- sia405_baseclass --- @@ -768,7 +772,7 @@ def overflow_common(row): abwasser_session.flush() logger.info("Exporting QGEP.private -> ABWASSER.privat, ABWASSER.metaattribute") - query = qgep_session.query(QGEP.private) + query = qgep_session.query(qgep_model.private) for row in query: # AVAILABLE FIELDS IN QGEP.private @@ -784,7 +788,7 @@ def overflow_common(row): # --- _rel_ --- # to do extra funktion schreiben wo alle fk auf diese klasse erzeugt werden z.B. # accessibility__REL, bedding_encasement__REL, - privat = ABWASSER.privat( + privat = abwasser_model.privat( # FIELDS TO MAP TO ABWASSER.privat # --- baseclass --- # --- sia405_baseclass --- @@ -801,94 +805,16 @@ def overflow_common(row): abwasser_session.flush() logger.info("Exporting QGEP.channel -> ABWASSER.kanal, ABWASSER.metaattribute") - query = qgep_session.query(QGEP.channel) - if filtered: - query = query.join(QGEP.wastewater_networkelement).filter( - QGEP.wastewater_networkelement.obj_id.in_(subset_ids) - ) - for row in query: - # AVAILABLE FIELDS IN QGEP.channel - - # --- wastewater_structure --- - # _bottom_label, _cover_label, _depth, _function_hierarchic, _input_label, _label, _output_label, _usage_current, accessibility, contract_section, detail_geometry_geometry, financing, fk_dataowner, fk_main_cover, fk_main_wastewater_node, fk_operator, fk_owner, fk_provider, gross_costs, identifier, inspection_interval, last_modification, location_name, records, remark, renovation_necessity, replacement_value, rv_base_year, rv_construction_type, status, structure_condition, subsidies, year_of_construction, year_of_replacement - - # --- _bwrel_ --- - # measuring_point__BWREL_fk_wastewater_structure, mechanical_pretreatment__BWREL_fk_wastewater_structure, re_maintenance_event_wastewater_structure__BWREL_fk_wastewater_structure, structure_part__BWREL_fk_wastewater_structure, txt_symbol__BWREL_fk_wastewater_structure, txt_text__BWREL_fk_wastewater_structure, wastewater_networkelement__BWREL_fk_wastewater_structure, wastewater_structure_symbol__BWREL_fk_wastewater_structure, wastewater_structure_text__BWREL_fk_wastewater_structure, wwtp_structure_kind__BWREL_obj_id - - # --- _rel_ --- - # accessibility__REL, bedding_encasement__REL, connection_type__REL, financing__REL, fk_dataowner__REL, fk_main_cover__REL, fk_main_wastewater_node__REL, fk_operator__REL, fk_owner__REL, fk_provider__REL, function_hierarchic__REL, function_hydraulic__REL, renovation_necessity__REL, rv_construction_type__REL, status__REL, structure_condition__REL, usage_current__REL, usage_planned__REL - - kanal = ABWASSER.kanal( - # FIELDS TO MAP TO ABWASSER.kanal - # --- baseclass --- - # --- sia405_baseclass --- - **qgep_export_utils.base_common(row, "kanal"), - # --- abwasserbauwerk --- - **qgep_export_utils.wastewater_structure_common(row), - # --- kanal --- - bettung_umhuellung=qgep_export_utils.get_vl(row.bedding_encasement__REL), - funktionhierarchisch=qgep_export_utils.get_vl(row.function_hierarchic__REL), - funktionhydraulisch=qgep_export_utils.get_vl(row.function_hydraulic__REL), - nutzungsart_geplant=qgep_export_utils.get_vl(row.usage_planned__REL), - nutzungsart_ist=qgep_export_utils.get_vl(row.usage_current__REL), - rohrlaenge=row.pipe_length, - spuelintervall=row.jetting_interval, - verbindungsart=qgep_export_utils.get_vl(row.connection_type__REL), - ) - abwasser_session.add(kanal) - qgep_export_utils.create_metaattributes(row) - print(".", end="") - logger.info("done") - abwasser_session.flush() + qgep_export_utils.export_channel() logger.info("Exporting QGEP.manhole -> ABWASSER.normschacht, ABWASSER.metaattribute") - query = qgep_session.query(QGEP.manhole) - if filtered: - query = query.join(QGEP.wastewater_networkelement).filter( - QGEP.wastewater_networkelement.obj_id.in_(subset_ids) - ) - for row in query: - # AVAILABLE FIELDS IN QGEP.manhole - - # --- wastewater_structure --- - # to do attributeslist of superclass - # --- manhole --- - # to do attributeslist of subclass - # to do extra funktion schreiben wo alle englischen attribute erzeugt werden - - # --- _bwrel_ --- - # to do extra funktion schreiben wo alle fk auf diese superklasse erzeugt werden z.B. # measuring_point__BWREL_fk_wastewater_structure, - - # --- _rel_ --- - # to do extra funktion schreiben wo alle fk auf diese klasse erzeugt werden z.B. # accessibility__REL, bedding_encasement__REL, - - normschacht = ABWASSER.normschacht( - # FIELDS TO MAP TO ABWASSER.normschacht - # --- baseclass --- - # --- sia405_baseclass --- - **qgep_export_utils.base_common(row, "normschacht"), - # --- abwasserbauwerk --- - **qgep_export_utils.wastewater_structure_common(row), - # --- normschacht --- - dimension1=row.dimension1, - dimension2=row.dimension2, - funktion=qgep_export_utils.get_vl(row.function__REL), - # -- attribute 3D --- - # maechtigkeit=row.depth, - material=qgep_export_utils.get_vl(row.material__REL), - oberflaechenzulauf=qgep_export_utils.get_vl(row.surface_inflow__REL), - ) - abwasser_session.add(normschacht) - qgep_export_utils.create_metaattributes(row) - print(".", end="") - logger.info("done") - abwasser_session.flush() + qgep_export_utils.export_manhole() logger.info("Exporting QGEP.discharge_point -> ABWASSER.einleitstelle, ABWASSER.metaattribute") - query = qgep_session.query(QGEP.discharge_point) + query = qgep_session.query(qgep_model.discharge_point) if filtered: - query = query.join(QGEP.wastewater_networkelement).filter( - QGEP.wastewater_networkelement.obj_id.in_(subset_ids) + query = query.join(qgep_model.wastewater_networkelement).filter( + qgep_model.wastewater_networkelement.obj_id.in_(subset_ids) ) for row in query: # AVAILABLE FIELDS IN QGEP.discharge_point @@ -905,7 +831,7 @@ def overflow_common(row): # --- _rel_ --- # to do extra funktion schreiben wo alle fk auf diese klasse erzeugt werden z.B. # accessibility__REL, bedding_encasement__REL, - einleitstelle = ABWASSER.einleitstelle( + einleitstelle = abwasser_model.einleitstelle( # FIELDS TO MAP TO ABWASSER.einleitstelle # --- baseclass --- # --- sia405_baseclass --- @@ -932,55 +858,15 @@ def overflow_common(row): logger.info( "Exporting QGEP.special_structure -> ABWASSER.spezialbauwerk, ABWASSER.metaattribute" ) - query = qgep_session.query(QGEP.special_structure) - if filtered: - query = query.join(QGEP.wastewater_networkelement).filter( - QGEP.wastewater_networkelement.obj_id.in_(subset_ids) - ) - for row in query: - # AVAILABLE FIELDS IN QGEP.special_structure - - # --- wastewater_structure --- - # _bottom_label, _cover_label, _depth, _function_hierarchic, _input_label, _label, _output_label, _usage_current, accessibility, contract_section, detail_geometry_geometry, financing, fk_dataowner, fk_main_cover, fk_main_wastewater_node, fk_operator, fk_owner, fk_provider, gross_costs, identifier, inspection_interval, last_modification, location_name, records, remark, renovation_necessity, replacement_value, rv_base_year, rv_construction_type, status, structure_condition, subsidies, year_of_construction, year_of_replacement - - # --- special_structure --- - # bypass, emergency_spillway, function, obj_id, stormwater_tank_arrangement, upper_elevation - - # --- _bwrel_ --- - # measuring_point__BWREL_fk_wastewater_structure, mechanical_pretreatment__BWREL_fk_wastewater_structure, re_maintenance_event_wastewater_structure__BWREL_fk_wastewater_structure, structure_part__BWREL_fk_wastewater_structure, txt_symbol__BWREL_fk_wastewater_structure, txt_text__BWREL_fk_wastewater_structure, wastewater_networkelement__BWREL_fk_wastewater_structure, wastewater_structure_symbol__BWREL_fk_wastewater_structure, wastewater_structure_text__BWREL_fk_wastewater_structure, wwtp_structure_kind__BWREL_obj_id - - # --- _rel_ --- - # accessibility__REL, bypass__REL, emergency_spillway__REL, financing__REL, fk_dataowner__REL, fk_main_cover__REL, fk_main_wastewater_node__REL, fk_operator__REL, fk_owner__REL, fk_provider__REL, function__REL, renovation_necessity__REL, rv_construction_type__REL, status__REL, stormwater_tank_arrangement__REL, structure_condition__REL - logger.warning( - "QGEP field special_structure.upper_elevation has no equivalent in the interlis model. It will be ignored." - ) - spezialbauwerk = ABWASSER.spezialbauwerk( - # FIELDS TO MAP TO ABWASSER.spezialbauwerk - # --- baseclass --- - # --- sia405_baseclass --- - **qgep_export_utils.base_common(row, "spezialbauwerk"), - # --- abwasserbauwerk --- - **qgep_export_utils.wastewater_structure_common(row), - # --- spezialbauwerk --- - # TODO : WARNING : upper_elevation is not mapped - bypass=qgep_export_utils.get_vl(row.bypass__REL), - funktion=qgep_export_utils.get_vl(row.function__REL), - notueberlauf=qgep_export_utils.get_vl(row.emergency_spillway__REL), - regenbecken_anordnung=qgep_export_utils.get_vl(row.stormwater_tank_arrangement__REL), - ) - abwasser_session.add(spezialbauwerk) - qgep_export_utils.create_metaattributes(row) - print(".", end="") - logger.info("done") - abwasser_session.flush() + qgep_export_utils.export_special_structure() logger.info( "Exporting QGEP.infiltration_installation -> ABWASSER.versickerungsanlage, ABWASSER.metaattribute" ) - query = qgep_session.query(QGEP.infiltration_installation) + query = qgep_session.query(qgep_model.infiltration_installation) if filtered: - query = query.join(QGEP.wastewater_networkelement).filter( - QGEP.wastewater_networkelement.obj_id.in_(subset_ids) + query = query.join(qgep_model.wastewater_networkelement).filter( + qgep_model.wastewater_networkelement.obj_id.in_(subset_ids) ) for row in query: # AVAILABLE FIELDS IN QGEP.infiltration_installation @@ -997,7 +883,7 @@ def overflow_common(row): # --- _rel_ --- # accessibility__REL, defects__REL, emergency_spillway__REL, financing__REL, fk_aquifier__REL, fk_dataowner__REL, fk_main_cover__REL, fk_main_wastewater_node__REL, fk_operator__REL, fk_owner__REL, fk_provider__REL, kind__REL, labeling__REL, renovation_necessity__REL, rv_construction_type__REL, seepage_utilization__REL, status__REL, structure_condition__REL, vehicle_access__REL, watertightness__REL - versickerungsanlage = ABWASSER.versickerungsanlage( + versickerungsanlage = abwasser_model.versickerungsanlage( # FIELDS TO MAP TO ABWASSER.versickerungsanlage # --- baseclass --- # --- sia405_baseclass --- @@ -1030,10 +916,10 @@ def overflow_common(row): abwasser_session.flush() logger.info("Exporting QGEP.wwtp_structure -> ABWASSER.arabauwerk, ABWASSER.metaattribute") - query = qgep_session.query(QGEP.wwtp_structure) + query = qgep_session.query(qgep_model.wwtp_structure) if filtered: - query = query.join(QGEP.wastewater_networkelement).filter( - QGEP.wastewater_networkelement.obj_id.in_(subset_ids) + query = query.join(qgep_model.wastewater_networkelement).filter( + qgep_model.wastewater_networkelement.obj_id.in_(subset_ids) ) for row in query: # AVAILABLE FIELDS IN QGEP.wwtp_structure @@ -1050,7 +936,7 @@ def overflow_common(row): # --- _rel_ --- # to do extra funktion schreiben wo alle fk auf diese klasse erzeugt werden z.B. # accessibility__REL, bedding_encasement__REL, - arabauwerk = ABWASSER.arabauwerk( + arabauwerk = abwasser_model.arabauwerk( # FIELDS TO MAP TO ABWASSER.arabauwerk # --- baseclass --- # --- sia405_baseclass --- @@ -1067,7 +953,7 @@ def overflow_common(row): abwasser_session.flush() logger.info("Exporting QGEP.planning_zone -> ABWASSER.planungszone, ABWASSER.metaattribute") - query = qgep_session.query(QGEP.planning_zone) + query = qgep_session.query(qgep_model.planning_zone) for row in query: # AVAILABLE FIELDS IN QGEP.planning_zone @@ -1083,7 +969,7 @@ def overflow_common(row): # --- _rel_ --- # to do extra funktion schreiben wo alle fk auf diese klasse erzeugt werden z.B. # accessibility__REL, bedding_encasement__REL, - planungszone = ABWASSER.planungszone( + planungszone = abwasser_model.planungszone( # FIELDS TO MAP TO ABWASSER.planungszone # --- baseclass --- # --- sia405_baseclass --- @@ -1103,7 +989,7 @@ def overflow_common(row): logger.info( "Exporting QGEP.infiltration_zone -> ABWASSER.versickerungsbereich, ABWASSER.metaattribute" ) - query = qgep_session.query(QGEP.infiltration_zone) + query = qgep_session.query(qgep_model.infiltration_zone) for row in query: # AVAILABLE FIELDS IN QGEP.infiltration_zone @@ -1119,7 +1005,7 @@ def overflow_common(row): # --- _rel_ --- # to do extra funktion schreiben wo alle fk auf diese klasse erzeugt werden z.B. # accessibility__REL, bedding_encasement__REL, - versickerungsbereich = ABWASSER.versickerungsbereich( + versickerungsbereich = abwasser_model.versickerungsbereich( # FIELDS TO MAP TO ABWASSER.versickerungsbereich # --- baseclass --- # --- sia405_baseclass --- @@ -1139,7 +1025,7 @@ def overflow_common(row): logger.info( "Exporting QGEP.drainage_system -> ABWASSER.entwaesserungssystem, ABWASSER.metaattribute" ) - query = qgep_session.query(QGEP.drainage_system) + query = qgep_session.query(qgep_model.drainage_system) for row in query: # AVAILABLE FIELDS IN QGEP.drainage_system @@ -1155,7 +1041,7 @@ def overflow_common(row): # --- _rel_ --- # to do extra funktion schreiben wo alle fk auf diese klasse erzeugt werden z.B. # accessibility__REL, bedding_encasement__REL, - entwaesserungssystem = ABWASSER.entwaesserungssystem( + entwaesserungssystem = abwasser_model.entwaesserungssystem( # FIELDS TO MAP TO ABWASSER.entwaesserungssystem # --- baseclass --- # --- sia405_baseclass --- @@ -1175,7 +1061,7 @@ def overflow_common(row): logger.info( "Exporting QGEP.water_body_protection_sector -> ABWASSER.gewaesserschutzbereich, ABWASSER.metaattribute" ) - query = qgep_session.query(QGEP.water_body_protection_sector) + query = qgep_session.query(qgep_model.water_body_protection_sector) for row in query: # AVAILABLE FIELDS IN QGEP.water_body_protection_sector @@ -1191,7 +1077,7 @@ def overflow_common(row): # --- _rel_ --- # to do extra funktion schreiben wo alle fk auf diese klasse erzeugt werden z.B. # accessibility__REL, bedding_encasement__REL, - gewaesserschutzbereich = ABWASSER.gewaesserschutzbereich( + gewaesserschutzbereich = abwasser_model.gewaesserschutzbereich( # FIELDS TO MAP TO ABWASSER.gewaesserschutzbereich # --- baseclass --- # --- sia405_baseclass --- @@ -1211,7 +1097,7 @@ def overflow_common(row): logger.info( "Exporting QGEP.ground_water_protection_perimeter -> ABWASSER.grundwasserschutzareal, ABWASSER.metaattribute" ) - query = qgep_session.query(QGEP.ground_water_protection_perimeter) + query = qgep_session.query(qgep_model.ground_water_protection_perimeter) for row in query: # AVAILABLE FIELDS IN QGEP.ground_water_protection_perimeter @@ -1227,7 +1113,7 @@ def overflow_common(row): # --- _rel_ --- # to do extra funktion schreiben wo alle fk auf diese klasse erzeugt werden z.B. # accessibility__REL, bedding_encasement__REL, - grundwasserschutzareal = ABWASSER.grundwasserschutzareal( + grundwasserschutzareal = abwasser_model.grundwasserschutzareal( # FIELDS TO MAP TO ABWASSER.grundwasserschutzareal # --- baseclass --- # --- sia405_baseclass --- @@ -1246,7 +1132,7 @@ def overflow_common(row): logger.info( "Exporting QGEP.groundwater_protection_zone -> ABWASSER.grundwasserschutzzone, ABWASSER.metaattribute" ) - query = qgep_session.query(QGEP.groundwater_protection_zone) + query = qgep_session.query(qgep_model.groundwater_protection_zone) for row in query: # AVAILABLE FIELDS IN QGEP.groundwater_protection_zone @@ -1262,7 +1148,7 @@ def overflow_common(row): # --- _rel_ --- # to do extra funktion schreiben wo alle fk auf diese klasse erzeugt werden z.B. # accessibility__REL, bedding_encasement__REL, - grundwasserschutzzone = ABWASSER.grundwasserschutzzone( + grundwasserschutzzone = abwasser_model.grundwasserschutzzone( # FIELDS TO MAP TO ABWASSER.grundwasserschutzzone # --- baseclass --- # --- sia405_baseclass --- @@ -1280,47 +1166,12 @@ def overflow_common(row): abwasser_session.flush() logger.info("Exporting QGEP.pipe_profile -> ABWASSER.rohrprofil, ABWASSER.metaattribute") - query = qgep_session.query(QGEP.pipe_profile) - if filtered: - query = query.join(QGEP.reach).filter( - QGEP.wastewater_networkelement.obj_id.in_(subset_ids) - ) - for row in query: - - # AVAILABLE FIELDS IN QGEP.pipe_profile - - # --- pipe_profile --- - # fk_dataowner, fk_provider, height_width_ratio, identifier, last_modification, obj_id, profile_type, remark - - # --- _bwrel_ --- - # profile_geometry__BWREL_fk_pipe_profile, reach__BWREL_fk_pipe_profile - - # --- _rel_ --- - # fk_dataowner__REL, fk_provider__REL, profile_type__REL - - rohrprofil = ABWASSER.rohrprofil( - # FIELDS TO MAP TO ABWASSER.rohrprofil - # --- baseclass --- - # --- sia405_baseclass --- - **qgep_export_utils.base_common(row, "rohrprofil"), - # --- rohrprofil --- - bemerkung=qgep_export_utils.truncate( - qgep_export_utils.emptystr_to_null(row.remark), 80 - ), - bezeichnung=qgep_export_utils.null_to_emptystr(row.identifier), - hoehenbreitenverhaeltnis=row.height_width_ratio, - profiltyp=qgep_export_utils.get_vl(row.profile_type__REL), - ) - abwasser_session.add(rohrprofil) - qgep_export_utils.create_metaattributes(row) - print(".", end="") - logger.info("done") - abwasser_session.flush() + qgep_export_utils.export_pipe_profile() logger.info( "Exporting QGEP.wwtp_energy_use -> ABWASSER.araenergienutzung, ABWASSER.metaattribute" ) - query = qgep_session.query(QGEP.wwtp_energy_use) + query = qgep_session.query(qgep_model.wwtp_energy_use) for row in query: # AVAILABLE FIELDS IN QGEP.wwtp_energy_use @@ -1333,7 +1184,7 @@ def overflow_common(row): # --- _rel_ --- # to do add relations fk_dataowner__REL, fk_provider__REL, profile_type__REL - araenergienutzung = ABWASSER.araenergienutzung( + araenergienutzung = abwasser_model.araenergienutzung( # FIELDS TO MAP TO ABWASSER.araenergienutzung # --- baseclass --- # --- sia405_baseclass --- @@ -1359,7 +1210,7 @@ def overflow_common(row): logger.info( "Exporting QGEP.waste_water_treatment -> ABWASSER.abwasserbehandlung, ABWASSER.metaattribute" ) - query = qgep_session.query(QGEP.waste_water_treatment) + query = qgep_session.query(qgep_model.waste_water_treatment) for row in query: # AVAILABLE FIELDS IN QGEP.waste_water_treatment @@ -1372,7 +1223,7 @@ def overflow_common(row): # --- _rel_ --- # to do add relations fk_dataowner__REL, fk_provider__REL, profile_type__REL - abwasserbehandlung = ABWASSER.abwasserbehandlung( + abwasserbehandlung = abwasser_model.abwasserbehandlung( # FIELDS TO MAP TO ABWASSER.abwasserbehandlung # --- baseclass --- # --- sia405_baseclass --- @@ -1396,7 +1247,7 @@ def overflow_common(row): logger.info( "Exporting QGEP.sludge_treatment -> ABWASSER.schlammbehandlung, ABWASSER.metaattribute" ) - query = qgep_session.query(QGEP.sludge_treatment) + query = qgep_session.query(qgep_model.sludge_treatment) for row in query: # AVAILABLE FIELDS IN QGEP.sludge_treatment @@ -1409,7 +1260,7 @@ def overflow_common(row): # --- _rel_ --- # to do add relations fk_dataowner__REL, fk_provider__REL, profile_type__REL - schlammbehandlung = ABWASSER.schlammbehandlung( + schlammbehandlung = abwasser_model.schlammbehandlung( # FIELDS TO MAP TO ABWASSER.schlammbehandlung # --- baseclass --- # --- sia405_baseclass --- @@ -1444,10 +1295,10 @@ def overflow_common(row): logger.info( "Exporting QGEP.control_center -> ABWASSER.steuerungszentrale, ABWASSER.metaattribute" ) - query = qgep_session.query(QGEP.control_center) + query = qgep_session.query(qgep_model.control_center) if filtered: - query = query.join(QGEP.throttle_shut_off_unit, QGEP.wastewater_node).filter( - QGEP.wastewater_networkelement.obj_id.in_(subset_ids) + query = query.join(qgep_model.throttle_shut_off_unit, qgep_model.wastewater_node).filter( + qgep_model.wastewater_networkelement.obj_id.in_(subset_ids) ) for row in query: @@ -1461,7 +1312,7 @@ def overflow_common(row): # --- _rel_ --- # to do add relations fk_dataowner__REL, fk_provider__REL, profile_type__REL - steuerungszentrale = ABWASSER.steuerungszentrale( + steuerungszentrale = abwasser_model.steuerungszentrale( # FIELDS TO MAP TO ABWASSER.steuerungszentrale # --- baseclass --- # --- sia405_baseclass --- @@ -1477,7 +1328,7 @@ def overflow_common(row): abwasser_session.flush() logger.info("Exporting QGEP.ford -> ABWASSER.furt, ABWASSER.metaattribute") - query = qgep_session.query(QGEP.ford) + query = qgep_session.query(qgep_model.ford) for row in query: # AVAILABLE FIELDS IN QGEP.ford @@ -1493,7 +1344,7 @@ def overflow_common(row): # --- _rel_ --- # to do extra funktion schreiben wo alle fk auf diese klasse erzeugt werden z.B. # accessibility__REL, bedding_encasement__REL, - furt = ABWASSER.furt( + furt = abwasser_model.furt( # FIELDS TO MAP TO ABWASSER.furt # --- baseclass --- # --- sia405_baseclass --- @@ -1509,7 +1360,7 @@ def overflow_common(row): abwasser_session.flush() logger.info("Exporting QGEP.chute -> ABWASSER.gewaesserabsturz, ABWASSER.metaattribute") - query = qgep_session.query(QGEP.chute) + query = qgep_session.query(qgep_model.chute) for row in query: # AVAILABLE FIELDS IN QGEP.chute @@ -1525,7 +1376,7 @@ def overflow_common(row): # --- _rel_ --- # to do extra funktion schreiben wo alle fk auf diese klasse erzeugt werden z.B. # accessibility__REL, bedding_encasement__REL, - gewaesserabsturz = ABWASSER.gewaesserabsturz( + gewaesserabsturz = abwasser_model.gewaesserabsturz( # FIELDS TO MAP TO ABWASSER.gewaesserabsturz # --- baseclass --- # --- sia405_baseclass --- @@ -1544,7 +1395,7 @@ def overflow_common(row): abwasser_session.flush() logger.info("Exporting QGEP.lock -> ABWASSER.schleuse, ABWASSER.metaattribute") - query = qgep_session.query(QGEP.lock) + query = qgep_session.query(qgep_model.lock) for row in query: # AVAILABLE FIELDS IN QGEP.lock @@ -1560,7 +1411,7 @@ def overflow_common(row): # --- _rel_ --- # to do extra funktion schreiben wo alle fk auf diese klasse erzeugt werden z.B. # accessibility__REL, bedding_encasement__REL, - schleuse = ABWASSER.schleuse( + schleuse = abwasser_model.schleuse( # FIELDS TO MAP TO ABWASSER.schleuse # --- baseclass --- # --- sia405_baseclass --- @@ -1577,7 +1428,7 @@ def overflow_common(row): abwasser_session.flush() logger.info("Exporting QGEP.passage -> ABWASSER.durchlass, ABWASSER.metaattribute") - query = qgep_session.query(QGEP.passage) + query = qgep_session.query(qgep_model.passage) for row in query: # AVAILABLE FIELDS IN QGEP.passage @@ -1593,7 +1444,7 @@ def overflow_common(row): # --- _rel_ --- # to do extra funktion schreiben wo alle fk auf diese klasse erzeugt werden z.B. # accessibility__REL, bedding_encasement__REL, - durchlass = ABWASSER.durchlass( + durchlass = abwasser_model.durchlass( # FIELDS TO MAP TO ABWASSER.durchlass # --- baseclass --- # --- sia405_baseclass --- @@ -1611,7 +1462,7 @@ def overflow_common(row): logger.info( "Exporting QGEP.blocking_debris -> ABWASSER.geschiebesperre, ABWASSER.metaattribute" ) - query = qgep_session.query(QGEP.blocking_debris) + query = qgep_session.query(qgep_model.blocking_debris) for row in query: # AVAILABLE FIELDS IN QGEP.blocking_debris @@ -1627,7 +1478,7 @@ def overflow_common(row): # --- _rel_ --- # to do extra funktion schreiben wo alle fk auf diese klasse erzeugt werden z.B. # accessibility__REL, bedding_encasement__REL, - geschiebesperre = ABWASSER.geschiebesperre( + geschiebesperre = abwasser_model.geschiebesperre( # FIELDS TO MAP TO ABWASSER.geschiebesperre # --- baseclass --- # --- sia405_baseclass --- @@ -1644,7 +1495,7 @@ def overflow_common(row): abwasser_session.flush() logger.info("Exporting QGEP.dam -> ABWASSER.gewaesserwehr, ABWASSER.metaattribute") - query = qgep_session.query(QGEP.dam) + query = qgep_session.query(qgep_model.dam) for row in query: # AVAILABLE FIELDS IN QGEP.dam @@ -1660,7 +1511,7 @@ def overflow_common(row): # --- _rel_ --- # to do extra funktion schreiben wo alle fk auf diese klasse erzeugt werden z.B. # accessibility__REL, bedding_encasement__REL, - gewaesserwehr = ABWASSER.gewaesserwehr( + gewaesserwehr = abwasser_model.gewaesserwehr( # FIELDS TO MAP TO ABWASSER.gewaesserwehr # --- baseclass --- # --- sia405_baseclass --- @@ -1678,7 +1529,7 @@ def overflow_common(row): abwasser_session.flush() logger.info("Exporting QGEP.rock_ramp -> ABWASSER.sohlrampe, ABWASSER.metaattribute") - query = qgep_session.query(QGEP.rock_ramp) + query = qgep_session.query(qgep_model.rock_ramp) for row in query: # AVAILABLE FIELDS IN QGEP.rock_ramp @@ -1694,7 +1545,7 @@ def overflow_common(row): # --- _rel_ --- # to do extra funktion schreiben wo alle fk auf diese klasse erzeugt werden z.B. # accessibility__REL, bedding_encasement__REL, - sohlrampe = ABWASSER.sohlrampe( + sohlrampe = abwasser_model.sohlrampe( # FIELDS TO MAP TO ABWASSER.sohlrampe # --- baseclass --- # --- sia405_baseclass --- @@ -1712,7 +1563,7 @@ def overflow_common(row): abwasser_session.flush() logger.info("Exporting QGEP.fish_pass -> ABWASSER.fischpass, ABWASSER.metaattribute") - query = qgep_session.query(QGEP.fish_pass) + query = qgep_session.query(qgep_model.fish_pass) for row in query: # AVAILABLE FIELDS IN QGEP.fish_pass @@ -1725,7 +1576,7 @@ def overflow_common(row): # --- _rel_ --- # to do add relations fk_dataowner__REL, fk_provider__REL, profile_type__REL - fischpass = ABWASSER.fischpass( + fischpass = abwasser_model.fischpass( # FIELDS TO MAP TO ABWASSER.fischpass # --- baseclass --- # --- sia405_baseclass --- @@ -1745,7 +1596,7 @@ def overflow_common(row): abwasser_session.flush() logger.info("Exporting QGEP.bathing_area -> ABWASSER.badestelle, ABWASSER.metaattribute") - query = qgep_session.query(QGEP.bathing_area) + query = qgep_session.query(qgep_model.bathing_area) for row in query: # AVAILABLE FIELDS IN QGEP.bathing_area @@ -1758,7 +1609,7 @@ def overflow_common(row): # --- _rel_ --- # to do add relations fk_dataowner__REL, fk_provider__REL, profile_type__REL - badestelle = ABWASSER.badestelle( + badestelle = abwasser_model.badestelle( # FIELDS TO MAP TO ABWASSER.badestelle # --- baseclass --- # --- sia405_baseclass --- @@ -1778,10 +1629,10 @@ def overflow_common(row): abwasser_session.flush() logger.info("Exporting QGEP.hydr_geometry -> ABWASSER.hydr_geometrie, ABWASSER.metaattribute") - query = qgep_session.query(QGEP.hydr_geometry) + query = qgep_session.query(qgep_model.hydr_geometry) if filtered: - query = query.join(QGEP.wastewater_node).filter( - QGEP.wastewater_networkelement.obj_id.in_(subset_ids) + query = query.join(qgep_model.wastewater_node).filter( + qgep_model.wastewater_networkelement.obj_id.in_(subset_ids) ) for row in query: @@ -1795,7 +1646,7 @@ def overflow_common(row): # --- _rel_ --- # to do add relations fk_dataowner__REL, fk_provider__REL, profile_type__REL - hydr_geometrie = ABWASSER.hydr_geometrie( + hydr_geometrie = abwasser_model.hydr_geometrie( # FIELDS TO MAP TO ABWASSER.hydr_geometrie # --- baseclass --- # --- sia405_baseclass --- @@ -1818,61 +1669,14 @@ def overflow_common(row): abwasser_session.flush() logger.info("Exporting QGEP.reach_point -> ABWASSER.haltungspunkt, ABWASSER.metaattribute") - query = qgep_session.query(QGEP.reach_point) - if filtered: - query = query.join( - QGEP.reach, - or_( - QGEP.reach_point.obj_id == QGEP.reach.fk_reach_point_from, - QGEP.reach_point.obj_id == QGEP.reach.fk_reach_point_to, - ), - ).filter(QGEP.wastewater_networkelement.obj_id.in_(subset_ids)) - for row in query: - - # AVAILABLE FIELDS IN QGEP.reach_point - - # --- reach_point --- - # elevation_accuracy, fk_dataowner, fk_provider, fk_wastewater_networkelement, identifier, last_modification, level, obj_id, outlet_shape, position_of_connection, remark, situation_geometry - - # --- _bwrel_ --- - # examination__BWREL_fk_reach_point, reach__BWREL_fk_reach_point_from, reach__BWREL_fk_reach_point_to - - # --- _rel_ --- - # elevation_accuracy__REL, fk_dataowner__REL, fk_provider__REL, fk_wastewater_networkelement__REL, outlet_shape__REL - - haltungspunkt = ABWASSER.haltungspunkt( - # FIELDS TO MAP TO ABWASSER.haltungspunkt - # --- baseclass --- - # --- sia405_baseclass --- - **qgep_export_utils.base_common(row, "haltungspunkt"), - # --- haltungspunkt --- - # changed call from qgep_export_utils.get_tid to qgep_export_utils.check_fk_in_subsetid so it does not wirte foreignkeys on elements that do not exist - # abwassernetzelementref=qgep_export_utils.get_tid(row.fk_wastewater_networkelement__REL), - abwassernetzelementref=qgep_export_utils.check_fk_in_subsetid( - subset_ids, row.fk_wastewater_networkelement__REL, filtered - ), - auslaufform=qgep_export_utils.get_vl(row.outlet_shape__REL), - bemerkung=qgep_export_utils.truncate( - qgep_export_utils.emptystr_to_null(row.remark), 80 - ), - bezeichnung=qgep_export_utils.null_to_emptystr(row.identifier), - hoehengenauigkeit=qgep_export_utils.get_vl(row.elevation_accuracy__REL), - kote=row.level, - lage=ST_Force2D(row.situation_geometry), - lage_anschluss=row.position_of_connection, - ) - abwasser_session.add(haltungspunkt) - qgep_export_utils.create_metaattributes(row) - print(".", end="") - logger.info("done") - abwasser_session.flush() + qgep_export_utils.export_reach_point() logger.info( "Exporting QGEP.wastewater_node -> ABWASSER.abwasserknoten, ABWASSER.metaattribute" ) - query = qgep_session.query(QGEP.wastewater_node) + query = qgep_session.query(qgep_model.wastewater_node) if filtered: - query = query.filter(QGEP.wastewater_networkelement.obj_id.in_(subset_ids)) + query = query.filter(qgep_model.wastewater_networkelement.obj_id.in_(subset_ids)) for row in query: # AVAILABLE FIELDS IN QGEP.wastewater_node @@ -1887,7 +1691,7 @@ def overflow_common(row): # --- _rel_ --- # fk_dataowner__REL, fk_hydr_geometry__REL, fk_provider__REL, fk_wastewater_structure__REL - abwasserknoten = ABWASSER.abwasserknoten( + abwasserknoten = abwasser_model.abwasserknoten( # FIELDS TO MAP TO ABWASSER.abwasserknoten # --- baseclass --- # --- sia405_baseclass --- @@ -1907,69 +1711,15 @@ def overflow_common(row): abwasser_session.flush() logger.info("Exporting QGEP.reach -> ABWASSER.haltung, ABWASSER.metaattribute") - query = qgep_session.query(QGEP.reach) - if filtered: - query = query.filter(QGEP.wastewater_networkelement.obj_id.in_(subset_ids)) - for row in query: - # AVAILABLE FIELDS IN QGEP.reach - - # --- wastewater_networkelement --- - # fk_dataowner, fk_provider, fk_wastewater_structure, identifier, last_modification, remark - - # --- reach --- - # clear_height, coefficient_of_friction, elevation_determination, fk_pipe_profile, fk_reach_point_from, fk_reach_point_to, horizontal_positioning, inside_coating, length_effective, material, obj_id, progression_geometry, reliner_material, reliner_nominal_size, relining_construction, relining_kind, ring_stiffness, slope_building_plan, wall_roughness - - # --- _bwrel_ --- - # catchment_area__BWREL_fk_wastewater_networkelement_rw_current, catchment_area__BWREL_fk_wastewater_networkelement_rw_planned, catchment_area__BWREL_fk_wastewater_networkelement_ww_current, catchment_area__BWREL_fk_wastewater_networkelement_ww_planned, connection_object__BWREL_fk_wastewater_networkelement, reach_point__BWREL_fk_wastewater_networkelement, reach_text__BWREL_fk_reach, txt_text__BWREL_fk_reach - - # --- _rel_ --- - # elevation_determination__REL, fk_dataowner__REL, fk_pipe_profile__REL, fk_provider__REL, fk_reach_point_from__REL, fk_reach_point_to__REL, fk_wastewater_structure__REL, horizontal_positioning__REL, inside_coating__REL, material__REL, reliner_material__REL, relining_construction__REL, relining_kind__REL - - logger.warning( - "QGEP field reach.elevation_determination has no equivalent in the interlis model. It will be ignored." - ) - haltung = ABWASSER.haltung( - # FIELDS TO MAP TO ABWASSER.haltung - # --- baseclass --- - # --- sia405_baseclass --- - **qgep_export_utils.base_common(row, "haltung"), - # --- abwassernetzelement --- - **qgep_export_utils.wastewater_networkelement_common(row), - # --- haltung --- - # NOT MAPPED : elevation_determination - innenschutz=qgep_export_utils.get_vl(row.inside_coating__REL), - laengeeffektiv=row.length_effective, - lagebestimmung=qgep_export_utils.get_vl(row.horizontal_positioning__REL), - lichte_hoehe=row.clear_height, - material=qgep_export_utils.get_vl(row.material__REL), - nachhaltungspunktref=qgep_export_utils.get_tid(row.fk_reach_point_to__REL), - plangefaelle=row.slope_building_plan, # TODO : check, does this need conversion ? - reibungsbeiwert=row.coefficient_of_friction, - reliner_art=qgep_export_utils.get_vl(row.relining_kind__REL), - reliner_bautechnik=qgep_export_utils.get_vl(row.relining_construction__REL), - reliner_material=qgep_export_utils.get_vl(row.reliner_material__REL), - reliner_nennweite=row.reliner_nominal_size, - ringsteifigkeit=row.ring_stiffness, - rohrprofilref=qgep_export_utils.get_tid(row.fk_pipe_profile__REL), - verlauf=ST_Force2D(row.progression_geometry), - # -- attribute 3D --- - # verlauf3d=row.progression3d, - vonhaltungspunktref=qgep_export_utils.get_tid(row.fk_reach_point_from__REL), - wandrauhigkeit=row.wall_roughness, - ) - abwasser_session.add(haltung) - qgep_export_utils.create_metaattributes(row) - print(".", end="") - logger.info("done") - abwasser_session.flush() + qgep_export_utils.export_reach() logger.info( "Exporting QGEP.profile_geometry -> ABWASSER.rohrprofil_geometrie, ABWASSER.metaattribute" ) - query = qgep_session.query(QGEP.profile_geometry) + query = qgep_session.query(qgep_model.profile_geometry) if filtered: - query = query.join(QGEP.pipe_profile, QGEP.reach).filter( - QGEP.wastewater_networkelement.obj_id.in_(subset_ids) + query = query.join(qgep_model.pipe_profile, qgep_model.reach).filter( + qgep_model.wastewater_networkelement.obj_id.in_(subset_ids) ) for row in query: @@ -1983,7 +1733,7 @@ def overflow_common(row): # --- _rel_ --- # to do add relations fk_dataowner__REL, fk_provider__REL, profile_type__REL - rohrprofil_geometrie = ABWASSER.rohrprofil_geometrie( + rohrprofil_geometrie = abwasser_model.rohrprofil_geometrie( # FIELDS TO MAP TO ABWASSER.rohrprofil_geometrie # --- baseclass --- # --- sia405_baseclass --- @@ -2003,10 +1753,10 @@ def overflow_common(row): logger.info( "Exporting QGEP.hydr_geom_relation -> ABWASSER.hydr_geomrelation, ABWASSER.metaattribute" ) - query = qgep_session.query(QGEP.hydr_geom_relation) + query = qgep_session.query(qgep_model.hydr_geom_relation) if filtered: - query = query.join(QGEP.hydr_geometry, QGEP.wastewater_node).filter( - QGEP.wastewater_networkelement.obj_id.in_(subset_ids) + query = query.join(qgep_model.hydr_geometry, qgep_model.wastewater_node).filter( + qgep_model.wastewater_networkelement.obj_id.in_(subset_ids) ) for row in query: @@ -2020,7 +1770,7 @@ def overflow_common(row): # --- _rel_ --- # to do add relations fk_dataowner__REL, fk_provider__REL, profile_type__REL - hydr_geomrelation = ABWASSER.hydr_geomrelation( + hydr_geomrelation = abwasser_model.hydr_geomrelation( # FIELDS TO MAP TO ABWASSER.hydr_geomrelation # --- baseclass --- # --- sia405_baseclass --- @@ -2040,11 +1790,11 @@ def overflow_common(row): logger.info( "Exporting QGEP.mechanical_pretreatment -> ABWASSER.mechanischevorreinigung, ABWASSER.metaattribute" ) - query = qgep_session.query(QGEP.mechanical_pretreatment) + query = qgep_session.query(qgep_model.mechanical_pretreatment) if filtered: - query = query.join(QGEP.wastewater_structure, QGEP.wastewater_networkelement).filter( - QGEP.wastewater_networkelement.obj_id.in_(subset_ids) - ) + query = query.join( + qgep_model.wastewater_structure, qgep_model.wastewater_networkelement + ).filter(qgep_model.wastewater_networkelement.obj_id.in_(subset_ids)) for row in query: # AVAILABLE FIELDS IN QGEP.mechanical_pretreatment @@ -2057,7 +1807,7 @@ def overflow_common(row): # --- _rel_ --- # to do add relations fk_dataowner__REL, fk_provider__REL, profile_type__REL - mechanischevorreinigung = ABWASSER.mechanischevorreinigung( + mechanischevorreinigung = abwasser_model.mechanischevorreinigung( # FIELDS TO MAP TO ABWASSER.mechanischevorreinigung # --- baseclass --- # --- sia405_baseclass --- @@ -2082,11 +1832,11 @@ def overflow_common(row): logger.info( "Exporting QGEP.retention_body -> ABWASSER.retentionskoerper, ABWASSER.metaattribute" ) - query = qgep_session.query(QGEP.retention_body) + query = qgep_session.query(qgep_model.retention_body) if filtered: - query = query.join(QGEP.infiltration_installation, QGEP.wastewater_networkelement).filter( - QGEP.wastewater_networkelement.obj_id.in_(subset_ids) - ) + query = query.join( + qgep_model.infiltration_installation, qgep_model.wastewater_networkelement + ).filter(qgep_model.wastewater_networkelement.obj_id.in_(subset_ids)) for row in query: # AVAILABLE FIELDS IN QGEP.retention_body @@ -2099,7 +1849,7 @@ def overflow_common(row): # --- _rel_ --- # to do add relations fk_dataowner__REL, fk_provider__REL, profile_type__REL - retentionskoerper = ABWASSER.retentionskoerper( + retentionskoerper = abwasser_model.retentionskoerper( # FIELDS TO MAP TO ABWASSER.retentionskoerper # --- baseclass --- # --- sia405_baseclass --- @@ -2124,7 +1874,7 @@ def overflow_common(row): logger.info( "Exporting QGEP.overflow_char -> ABWASSER.ueberlaufcharakteristik, ABWASSER.metaattribute" ) - query = qgep_session.query(QGEP.overflow_char) + query = qgep_session.query(qgep_model.overflow_char) # always export all overflow_char datasets if filtered: # add sql statement to logger @@ -2142,7 +1892,7 @@ def overflow_common(row): # --- _rel_ --- # to do add relations fk_dataowner__REL, fk_provider__REL, profile_type__REL - ueberlaufcharakteristik = ABWASSER.ueberlaufcharakteristik( + ueberlaufcharakteristik = abwasser_model.ueberlaufcharakteristik( # FIELDS TO MAP TO ABWASSER.ueberlaufcharakteristik # --- baseclass --- # --- sia405_baseclass --- @@ -2162,11 +1912,11 @@ def overflow_common(row): abwasser_session.flush() logger.info("Exporting QGEP.hq_relation -> ABWASSER.hq_relation, ABWASSER.metaattribute") - query = qgep_session.query(QGEP.hq_relation) + query = qgep_session.query(qgep_model.hq_relation) if filtered: # just check if overflow_char exists, but no filter query = query.join( - QGEP.overflow_char, + qgep_model.overflow_char, ) # add sql statement to logger statement = query.statement @@ -2183,7 +1933,7 @@ def overflow_common(row): # --- _rel_ --- # to do add relations fk_dataowner__REL, fk_provider__REL, profile_type__REL - hq_relation = ABWASSER.hq_relation( + hq_relation = abwasser_model.hq_relation( # FIELDS TO MAP TO ABWASSER.hq_relation # --- baseclass --- # --- sia405_baseclass --- @@ -2203,172 +1953,27 @@ def overflow_common(row): logger.info( "Exporting QGEP.dryweather_downspout -> ABWASSER.trockenwetterfallrohr, ABWASSER.metaattribute" ) - query = qgep_session.query(QGEP.dryweather_downspout) - if filtered: - query = query.join(QGEP.wastewater_structure, QGEP.wastewater_networkelement).filter( - QGEP.wastewater_networkelement.obj_id.in_(subset_ids) - ) - for row in query: - # AVAILABLE FIELDS IN QGEP.dryweather_downspout - - # --- structure_part --- - # fk_dataowner, fk_provider, fk_wastewater_structure, identifier, last_modification, remark, renovation_demand - - # --- dryweather_downspout --- - # diameter, obj_id - - # --- _bwrel_ --- - # access_aid_kind__BWREL_obj_id, backflow_prevention__BWREL_obj_id, benching_kind__BWREL_obj_id, dryweather_flume_material__BWREL_obj_id, electric_equipment__BWREL_obj_id, electromechanical_equipment__BWREL_obj_id, solids_retention__BWREL_obj_id, tank_cleaning__BWREL_obj_id, tank_emptying__BWREL_obj_id - - # --- _rel_ --- - # fk_dataowner__REL, fk_provider__REL, fk_wastewater_structure__REL, renovation_demand__REL - - trockenwetterfallrohr = ABWASSER.trockenwetterfallrohr( - # FIELDS TO MAP TO ABWASSER.trockenwetterfallrohr - # --- baseclass --- - # --- sia405_baseclass --- - **qgep_export_utils.base_common(row, "trockenwetterfallrohr"), - # --- bauwerksteil --- - **qgep_export_utils.structure_part_common(row), - # --- trockenwetterfallrohr --- - durchmesser=row.diameter, - ) - abwasser_session.add(trockenwetterfallrohr) - qgep_export_utils.create_metaattributes(row) - print(".", end="") - logger.info("done") - abwasser_session.flush() + qgep_export_utils.export_dryweather_downspout() logger.info("Exporting QGEP.access_aid -> ABWASSER.einstiegshilfe, ABWASSER.metaattribute") - query = qgep_session.query(QGEP.access_aid) - if filtered: - query = query.join(QGEP.wastewater_structure, QGEP.wastewater_networkelement).filter( - QGEP.wastewater_networkelement.obj_id.in_(subset_ids) - ) - for row in query: - # AVAILABLE FIELDS IN QGEP.access_aid - - # --- structure_part --- - # fk_dataowner, fk_provider, fk_wastewater_structure, identifier, last_modification, remark, renovation_demand - - # --- access_aid --- - # kind, obj_id - - # --- _bwrel_ --- - # access_aid_kind__BWREL_obj_id, backflow_prevention__BWREL_obj_id, benching_kind__BWREL_obj_id, dryweather_flume_material__BWREL_obj_id, electric_equipment__BWREL_obj_id, electromechanical_equipment__BWREL_obj_id, solids_retention__BWREL_obj_id, tank_cleaning__BWREL_obj_id, tank_emptying__BWREL_obj_id - - # --- _rel_ --- - # fk_dataowner__REL, fk_provider__REL, fk_wastewater_structure__REL, kind__REL, renovation_demand__REL - - einstiegshilfe = ABWASSER.einstiegshilfe( - # FIELDS TO MAP TO ABWASSER.einstiegshilfe - # --- baseclass --- - # --- sia405_baseclass --- - **qgep_export_utils.base_common(row, "einstiegshilfe"), - # --- bauwerksteil --- - **qgep_export_utils.structure_part_common(row), - # --- einstiegshilfe --- - art=qgep_export_utils.get_vl(row.kind__REL), - ) - abwasser_session.add(einstiegshilfe) - qgep_export_utils.create_metaattributes(row) - print(".", end="") - logger.info("done") - abwasser_session.flush() + qgep_export_utils.export_access_aid() logger.info( "Exporting QGEP.dryweather_flume -> ABWASSER.trockenwetterrinne, ABWASSER.metaattribute" ) - query = qgep_session.query(QGEP.dryweather_flume) - if filtered: - query = query.join(QGEP.wastewater_structure, QGEP.wastewater_networkelement).filter( - QGEP.wastewater_networkelement.obj_id.in_(subset_ids) - ) - for row in query: - # AVAILABLE FIELDS IN QGEP.dryweather_flume - - # --- structure_part --- - # fk_dataowner, fk_provider, fk_wastewater_structure, identifier, last_modification, remark, renovation_demand - - # --- dryweather_flume --- - # material, obj_id - - # --- _bwrel_ --- - # access_aid_kind__BWREL_obj_id, backflow_prevention__BWREL_obj_id, benching_kind__BWREL_obj_id, dryweather_flume_material__BWREL_obj_id, electric_equipment__BWREL_obj_id, electromechanical_equipment__BWREL_obj_id, solids_retention__BWREL_obj_id, tank_cleaning__BWREL_obj_id, tank_emptying__BWREL_obj_id - - # --- _rel_ --- - # fk_dataowner__REL, fk_provider__REL, fk_wastewater_structure__REL, material__REL, renovation_demand__REL - - trockenwetterrinne = ABWASSER.trockenwetterrinne( - # FIELDS TO MAP TO ABWASSER.trockenwetterrinne - # --- baseclass --- - # --- sia405_baseclass --- - **qgep_export_utils.base_common(row, "trockenwetterrinne"), - # --- bauwerksteil --- - **qgep_export_utils.structure_part_common(row), - # --- trockenwetterrinne --- - material=qgep_export_utils.get_vl(row.material__REL), - ) - abwasser_session.add(trockenwetterrinne) - qgep_export_utils.create_metaattributes(row) - print(".", end="") - logger.info("done") - abwasser_session.flush() + qgep_export_utils.export_dryweather_flume() logger.info("Exporting QGEP.cover -> ABWASSER.deckel, ABWASSER.metaattribute") - query = qgep_session.query(QGEP.cover) - if filtered: - query = query.join(QGEP.wastewater_structure, QGEP.wastewater_networkelement).filter( - QGEP.wastewater_networkelement.obj_id.in_(subset_ids) - ) - for row in query: - # AVAILABLE FIELDS IN QGEP.cover - - # --- structure_part --- - # fk_dataowner, fk_provider, fk_wastewater_structure, identifier, last_modification, remark, renovation_demand - - # --- cover --- - # brand, cover_shape, diameter, fastening, level, material, obj_id, positional_accuracy, situation_geometry, sludge_bucket, venting - - # --- _bwrel_ --- - # access_aid_kind__BWREL_obj_id, backflow_prevention__BWREL_obj_id, benching_kind__BWREL_obj_id, dryweather_flume_material__BWREL_obj_id, electric_equipment__BWREL_obj_id, electromechanical_equipment__BWREL_obj_id, solids_retention__BWREL_obj_id, tank_cleaning__BWREL_obj_id, tank_emptying__BWREL_obj_id, wastewater_structure__BWREL_fk_main_cover - - # --- _rel_ --- - # cover_shape__REL, fastening__REL, fk_dataowner__REL, fk_provider__REL, fk_wastewater_structure__REL, material__REL, positional_accuracy__REL, renovation_demand__REL, sludge_bucket__REL, venting__REL - - deckel = ABWASSER.deckel( - # FIELDS TO MAP TO ABWASSER.deckel - # --- baseclass --- - # --- sia405_baseclass --- - **qgep_export_utils.base_common(row, "deckel"), - # --- bauwerksteil --- - **qgep_export_utils.structure_part_common(row), - # --- deckel --- - deckelform=qgep_export_utils.get_vl(row.cover_shape__REL), - durchmesser=row.diameter, - entlueftung=qgep_export_utils.get_vl(row.venting__REL), - fabrikat=row.brand, - kote=row.level, - lage=ST_Force2D(row.situation_geometry), - lagegenauigkeit=qgep_export_utils.get_vl(row.positional_accuracy__REL), - material=qgep_export_utils.get_vl(row.material__REL), - schlammeimer=qgep_export_utils.get_vl(row.sludge_bucket__REL), - verschluss=qgep_export_utils.get_vl(row.fastening__REL), - ) - abwasser_session.add(deckel) - qgep_export_utils.create_metaattributes(row) - print(".", end="") - logger.info("done") - abwasser_session.flush() + qgep_export_utils.export_cover() logger.info( "Exporting QGEP.electric_equipment -> ABWASSER.elektrischeeinrichtung, ABWASSER.metaattribute" ) - query = qgep_session.query(QGEP.electric_equipment) + query = qgep_session.query(qgep_model.electric_equipment) if filtered: - query = query.join(QGEP.wastewater_structure, QGEP.wastewater_networkelement).filter( - QGEP.wastewater_networkelement.obj_id.in_(subset_ids) - ) + query = query.join( + qgep_model.wastewater_structure, qgep_model.wastewater_networkelement + ).filter(qgep_model.wastewater_networkelement.obj_id.in_(subset_ids)) for row in query: # AVAILABLE FIELDS IN QGEP.electric_equipment @@ -2384,7 +1989,7 @@ def overflow_common(row): # --- _rel_ --- # to do extra funktion schreiben wo alle fk auf diese klasse erzeugt werden z.B. # accessibility__REL, bedding_encasement__REL, - elektrischeeinrichtung = ABWASSER.elektrischeeinrichtung( + elektrischeeinrichtung = abwasser_model.elektrischeeinrichtung( # FIELDS TO MAP TO ABWASSER.elektrischeeinrichtung # --- baseclass --- # --- sia405_baseclass --- @@ -2405,11 +2010,11 @@ def overflow_common(row): logger.info( "Exporting QGEP.electromechanical_equipment -> ABWASSER.elektromechanischeausruestung, ABWASSER.metaattribute" ) - query = qgep_session.query(QGEP.electromechanical_equipment) + query = qgep_session.query(qgep_model.electromechanical_equipment) if filtered: - query = query.join(QGEP.wastewater_structure, QGEP.wastewater_networkelement).filter( - QGEP.wastewater_networkelement.obj_id.in_(subset_ids) - ) + query = query.join( + qgep_model.wastewater_structure, qgep_model.wastewater_networkelement + ).filter(qgep_model.wastewater_networkelement.obj_id.in_(subset_ids)) for row in query: # AVAILABLE FIELDS IN QGEP.electromechanical_equipment @@ -2425,7 +2030,7 @@ def overflow_common(row): # --- _rel_ --- # to do extra funktion schreiben wo alle fk auf diese klasse erzeugt werden z.B. # accessibility__REL, bedding_encasement__REL, - elektromechanischeausruestung = ABWASSER.elektromechanischeausruestung( + elektromechanischeausruestung = abwasser_model.elektromechanischeausruestung( # FIELDS TO MAP TO ABWASSER.elektromechanischeausruestung # --- baseclass --- # --- sia405_baseclass --- @@ -2444,47 +2049,13 @@ def overflow_common(row): abwasser_session.flush() logger.info("Exporting QGEP.benching -> ABWASSER.bankett, ABWASSER.metaattribute") - query = qgep_session.query(QGEP.benching) - if filtered: - query = query.join(QGEP.wastewater_structure, QGEP.wastewater_networkelement).filter( - QGEP.wastewater_networkelement.obj_id.in_(subset_ids) - ) - for row in query: - # AVAILABLE FIELDS IN QGEP.benching - - # --- structure_part --- - # fk_dataowner, fk_provider, fk_wastewater_structure, identifier, last_modification, remark, renovation_demand - - # --- benching --- - # kind, obj_id - - # --- _bwrel_ --- - # access_aid_kind__BWREL_obj_id, backflow_prevention__BWREL_obj_id, benching_kind__BWREL_obj_id, dryweather_flume_material__BWREL_obj_id, electric_equipment__BWREL_obj_id, electromechanical_equipment__BWREL_obj_id, solids_retention__BWREL_obj_id, tank_cleaning__BWREL_obj_id, tank_emptying__BWREL_obj_id - - # --- _rel_ --- - # fk_dataowner__REL, fk_provider__REL, fk_wastewater_structure__REL, kind__REL, renovation_demand__REL - - bankett = ABWASSER.bankett( - # FIELDS TO MAP TO ABWASSER.bankett - # --- baseclass --- - # --- sia405_baseclass --- - **qgep_export_utils.base_common(row, "bankett"), - # --- bauwerksteil --- - **qgep_export_utils.structure_part_common(row), - # --- bankett --- - art=qgep_export_utils.get_vl(row.kind__REL), - ) - abwasser_session.add(bankett) - qgep_export_utils.create_metaattributes(row) - print(".", end="") - logger.info("done") - abwasser_session.flush() + qgep_export_utils.export_benching() logger.info("Exporting QGEP.building -> ABWASSER.gebaeude, ABWASSER.metaattribute") - query = qgep_session.query(QGEP.building) + query = qgep_session.query(qgep_model.building) if filtered: - query = query.join(QGEP.wastewater_networkelement).filter( - QGEP.wastewater_networkelement.obj_id.in_(subset_ids) + query = query.join(qgep_model.wastewater_networkelement).filter( + qgep_model.wastewater_networkelement.obj_id.in_(subset_ids) ) for row in query: # AVAILABLE FIELDS IN QGEP.building @@ -2501,7 +2072,7 @@ def overflow_common(row): # --- _rel_ --- # to do extra funktion schreiben wo alle fk auf diese klasse erzeugt werden z.B. # accessibility__REL, bedding_encasement__REL, - gebaeude = ABWASSER.gebaeude( + gebaeude = abwasser_model.gebaeude( # FIELDS TO MAP TO ABWASSER.gebaeude # --- baseclass --- # --- sia405_baseclass --- @@ -2521,10 +2092,10 @@ def overflow_common(row): abwasser_session.flush() logger.info("Exporting QGEP.reservoir -> ABWASSER.reservoir, ABWASSER.metaattribute") - query = qgep_session.query(QGEP.reservoir) + query = qgep_session.query(qgep_model.reservoir) if filtered: - query = query.join(QGEP.wastewater_networkelement).filter( - QGEP.wastewater_networkelement.obj_id.in_(subset_ids) + query = query.join(qgep_model.wastewater_networkelement).filter( + qgep_model.wastewater_networkelement.obj_id.in_(subset_ids) ) for row in query: # AVAILABLE FIELDS IN QGEP.reservoir @@ -2541,7 +2112,7 @@ def overflow_common(row): # --- _rel_ --- # to do extra funktion schreiben wo alle fk auf diese klasse erzeugt werden z.B. # accessibility__REL, bedding_encasement__REL, - reservoir = ABWASSER.reservoir( + reservoir = abwasser_model.reservoir( # FIELDS TO MAP TO ABWASSER.reservoir # --- baseclass --- # --- sia405_baseclass --- @@ -2561,10 +2132,10 @@ def overflow_common(row): logger.info( "Exporting QGEP.individual_surface -> ABWASSER.einzelflaeche, ABWASSER.metaattribute" ) - query = qgep_session.query(QGEP.individual_surface) + query = qgep_session.query(qgep_model.individual_surface) if filtered: - query = query.join(QGEP.wastewater_networkelement).filter( - QGEP.wastewater_networkelement.obj_id.in_(subset_ids) + query = query.join(qgep_model.wastewater_networkelement).filter( + qgep_model.wastewater_networkelement.obj_id.in_(subset_ids) ) for row in query: # AVAILABLE FIELDS IN QGEP.individual_surface @@ -2581,7 +2152,7 @@ def overflow_common(row): # --- _rel_ --- # to do extra funktion schreiben wo alle fk auf diese klasse erzeugt werden z.B. # accessibility__REL, bedding_encasement__REL, - einzelflaeche = ABWASSER.einzelflaeche( + einzelflaeche = abwasser_model.einzelflaeche( # FIELDS TO MAP TO ABWASSER.einzelflaeche # --- baseclass --- # --- sia405_baseclass --- @@ -2601,10 +2172,10 @@ def overflow_common(row): abwasser_session.flush() logger.info("Exporting QGEP.fountain -> ABWASSER.brunnen, ABWASSER.metaattribute") - query = qgep_session.query(QGEP.fountain) + query = qgep_session.query(qgep_model.fountain) if filtered: - query = query.join(QGEP.wastewater_networkelement).filter( - QGEP.wastewater_networkelement.obj_id.in_(subset_ids) + query = query.join(qgep_model.wastewater_networkelement).filter( + qgep_model.wastewater_networkelement.obj_id.in_(subset_ids) ) for row in query: # AVAILABLE FIELDS IN QGEP.fountain @@ -2621,7 +2192,7 @@ def overflow_common(row): # --- _rel_ --- # to do extra funktion schreiben wo alle fk auf diese klasse erzeugt werden z.B. # accessibility__REL, bedding_encasement__REL, - brunnen = ABWASSER.brunnen( + brunnen = abwasser_model.brunnen( # FIELDS TO MAP TO ABWASSER.brunnen # --- baseclass --- # --- sia405_baseclass --- @@ -2639,11 +2210,11 @@ def overflow_common(row): abwasser_session.flush() logger.info("Exporting QGEP.hazard_source -> ABWASSER.gefahrenquelle, ABWASSER.metaattribute") - query = qgep_session.query(QGEP.hazard_source) + query = qgep_session.query(qgep_model.hazard_source) if filtered: - query = query.join(QGEP.connection_object, QGEP.wastewater_networkelement).filter( - QGEP.wastewater_networkelement.obj_id.in_(subset_ids) - ) + query = query.join( + qgep_model.connection_object, qgep_model.wastewater_networkelement + ).filter(qgep_model.wastewater_networkelement.obj_id.in_(subset_ids)) for row in query: # AVAILABLE FIELDS IN QGEP.hazard_source @@ -2656,7 +2227,7 @@ def overflow_common(row): # --- _rel_ --- # to do add relations fk_dataowner__REL, fk_provider__REL, profile_type__REL - gefahrenquelle = ABWASSER.gefahrenquelle( + gefahrenquelle = abwasser_model.gefahrenquelle( # FIELDS TO MAP TO ABWASSER.gefahrenquelle # --- baseclass --- # --- sia405_baseclass --- @@ -2677,11 +2248,13 @@ def overflow_common(row): abwasser_session.flush() logger.info("Exporting QGEP.accident -> ABWASSER.unfall, ABWASSER.metaattribute") - query = qgep_session.query(QGEP.accident) + query = qgep_session.query(qgep_model.accident) if filtered: query = query.join( - QGEP.hazard_source, QGEP.connection_object, QGEP.wastewater_networkelement - ).filter(QGEP.wastewater_networkelement.obj_id.in_(subset_ids)) + qgep_model.hazard_source, + qgep_model.connection_object, + qgep_model.wastewater_networkelement, + ).filter(qgep_model.wastewater_networkelement.obj_id.in_(subset_ids)) for row in query: # AVAILABLE FIELDS IN QGEP.accident @@ -2694,7 +2267,7 @@ def overflow_common(row): # --- _rel_ --- # to do add relations fk_dataowner__REL, fk_provider__REL, profile_type__REL - unfall = ABWASSER.unfall( + unfall = abwasser_model.unfall( # FIELDS TO MAP TO ABWASSER.unfall # --- baseclass --- # --- sia405_baseclass --- @@ -2717,11 +2290,13 @@ def overflow_common(row): abwasser_session.flush() logger.info("Exporting QGEP.substance -> ABWASSER.stoff, ABWASSER.metaattribute") - query = qgep_session.query(QGEP.substance) + query = qgep_session.query(qgep_model.substance) if filtered: query = query.join( - QGEP.hazard_source, QGEP.connection_object, QGEP.wastewater_networkelement - ).filter(QGEP.wastewater_networkelement.obj_id.in_(subset_ids)) + qgep_model.hazard_source, + qgep_model.connection_object, + qgep_model.wastewater_networkelement, + ).filter(qgep_model.wastewater_networkelement.obj_id.in_(subset_ids)) for row in query: # AVAILABLE FIELDS IN QGEP.substance @@ -2734,7 +2309,7 @@ def overflow_common(row): # --- _rel_ --- # to do add relations fk_dataowner__REL, fk_provider__REL, profile_type__REL - stoff = ABWASSER.stoff( + stoff = abwasser_model.stoff( # FIELDS TO MAP TO ABWASSER.stoff # --- baseclass --- # --- sia405_baseclass --- @@ -2755,21 +2330,21 @@ def overflow_common(row): abwasser_session.flush() logger.info("Exporting QGEP.catchment_area -> ABWASSER.einzugsgebiet, ABWASSER.metaattribute") - query = qgep_session.query(QGEP.catchment_area) + query = qgep_session.query(qgep_model.catchment_area) if filtered: query = query.join( - QGEP.wastewater_networkelement, + qgep_model.wastewater_networkelement, or_( - QGEP.wastewater_networkelement.obj_id - == QGEP.catchment_area.fk_wastewater_networkelement_rw_planned, - QGEP.wastewater_networkelement.obj_id - == QGEP.catchment_area.fk_wastewater_networkelement_rw_current, - QGEP.wastewater_networkelement.obj_id - == QGEP.catchment_area.fk_wastewater_networkelement_ww_planned, - QGEP.wastewater_networkelement.obj_id - == QGEP.catchment_area.fk_wastewater_networkelement_ww_current, + qgep_model.wastewater_networkelement.obj_id + == qgep_model.catchment_area.fk_wastewater_networkelement_rw_planned, + qgep_model.wastewater_networkelement.obj_id + == qgep_model.catchment_area.fk_wastewater_networkelement_rw_current, + qgep_model.wastewater_networkelement.obj_id + == qgep_model.catchment_area.fk_wastewater_networkelement_ww_planned, + qgep_model.wastewater_networkelement.obj_id + == qgep_model.catchment_area.fk_wastewater_networkelement_ww_current, ), - ).filter(QGEP.wastewater_networkelement.obj_id.in_(subset_ids)) + ).filter(qgep_model.wastewater_networkelement.obj_id.in_(subset_ids)) for row in query: # AVAILABLE FIELDS IN QGEP.catchment_area @@ -2782,7 +2357,7 @@ def overflow_common(row): # --- _rel_ --- # to do add relations fk_dataowner__REL, fk_provider__REL, profile_type__REL - einzugsgebiet = ABWASSER.einzugsgebiet( + einzugsgebiet = abwasser_model.einzugsgebiet( # FIELDS TO MAP TO ABWASSER.einzugsgebiet # --- baseclass --- # --- sia405_baseclass --- @@ -2796,16 +2371,16 @@ def overflow_common(row): abflussbeiwert_sw_ist=row.discharge_coefficient_ww_current, # changed call from qgep_export_utils.get_tid to qgep_export_utils.check_fk_in_subsetid so it does not write foreignkeys on elements that do not exist abwassernetzelement_rw_geplantref=qgep_export_utils.check_fk_in_subsetid( - subset_ids, row.fk_wastewater_networkelement_rw_planned__REL, filtered + subset_ids, row.fk_wastewater_networkelement_rw_planned__REL ), abwassernetzelement_rw_istref=qgep_export_utils.check_fk_in_subsetid( - subset_ids, row.fk_wastewater_networkelement_rw_current__REL, filtered + subset_ids, row.fk_wastewater_networkelement_rw_current__REL ), abwassernetzelement_sw_geplantref=qgep_export_utils.check_fk_in_subsetid( - subset_ids, row.fk_wastewater_networkelement_ww_planned__REL, filtered + subset_ids, row.fk_wastewater_networkelement_ww_planned__REL ), abwassernetzelement_sw_istref=qgep_export_utils.check_fk_in_subsetid( - subset_ids, row.fk_wastewater_networkelement_ww_current__REL, filtered + subset_ids, row.fk_wastewater_networkelement_ww_current__REL ), befestigungsgrad_rw_geplant=row.seal_factor_rw_planned, befestigungsgrad_rw_ist=row.seal_factor_rw_current, @@ -2850,11 +2425,11 @@ def overflow_common(row): abwasser_session.flush() logger.info("Exporting QGEP.measuring_point -> ABWASSER.messstelle, ABWASSER.metaattribute") - query = qgep_session.query(QGEP.measuring_point) + query = qgep_session.query(qgep_model.measuring_point) if filtered: query1 = query.join( - QGEP.wastewater_structure, - QGEP.wastewater_networkelement, + qgep_model.wastewater_structure, + qgep_model.wastewater_networkelement, ) # needs to add QGEP.wastewater_structure as waste_water_treatment_plant is a subclass of organisation that has a relation to wastewater_structure and then wastewater_networkelement # variant1 for query2 @@ -2875,21 +2450,21 @@ def overflow_common(row): # ) # query2 via waste_water_treatment_plant TODO : Fix Mapping query2 = query.join( - QGEP.model_classes_tww_od.waste_water_treatment_plant, - QGEP.model_classes_tww_od.wwtp_structure, - QGEP.model_classes_tww_od.wastewater_networkelement, + qgep_model.model_classes_tww_od.waste_water_treatment_plant, + qgep_model.model_classes_tww_od.wwtp_structure, + qgep_model.model_classes_tww_od.wastewater_networkelement, ) # only until VSA-DSS Release 2015 query3 = query.join( - QGEP.water_course_segment, - QGEP.river, - QGEP.sector_water_body, - QGEP.discharge_point, - QGEP.wastewater_networkelement, + qgep_model.water_course_segment, + qgep_model.river, + qgep_model.sector_water_body, + qgep_model.discharge_point, + qgep_model.wastewater_networkelement, ) query = query.union(query1, query2, query3) # query = query.union(query1, query3) - query = query.filter(QGEP.wastewater_networkelement.obj_id.in_(subset_ids)) + query = query.filter(qgep_model.wastewater_networkelement.obj_id.in_(subset_ids)) for row in query: # AVAILABLE FIELDS IN QGEP.measuring_point @@ -2902,7 +2477,7 @@ def overflow_common(row): # --- _rel_ --- # to do add relations fk_dataowner__REL, fk_provider__REL, profile_type__REL - messstelle = ABWASSER.messstelle( + messstelle = abwasser_model.messstelle( # FIELDS TO MAP TO ABWASSER.messstelle # --- baseclass --- # --- sia405_baseclass --- @@ -2932,11 +2507,13 @@ def overflow_common(row): abwasser_session.flush() logger.info("Exporting QGEP.measuring_device -> ABWASSER.messgeraet, ABWASSER.metaattribute") - query = qgep_session.query(QGEP.measuring_device) + query = qgep_session.query(qgep_model.measuring_device) if filtered: query = query.join( - QGEP.measuring_point, QGEP.wastewater_structure, QGEP.wastewater_networkelement - ).filter(QGEP.wastewater_networkelement.obj_id.in_(subset_ids)) + qgep_model.measuring_point, + qgep_model.wastewater_structure, + qgep_model.wastewater_networkelement, + ).filter(qgep_model.wastewater_networkelement.obj_id.in_(subset_ids)) # or does not work with this - currently do not support # QGEP.wastewater_networkelement, # or_( @@ -2957,7 +2534,7 @@ def overflow_common(row): # --- _rel_ --- # to do add relations fk_dataowner__REL, fk_provider__REL, profile_type__REL - messgeraet = ABWASSER.messgeraet( + messgeraet = abwasser_model.messgeraet( # FIELDS TO MAP TO ABWASSER.messgeraet # --- baseclass --- # --- sia405_baseclass --- @@ -2979,11 +2556,13 @@ def overflow_common(row): abwasser_session.flush() logger.info("Exporting QGEP.measurement_series -> ABWASSER.messreihe, ABWASSER.metaattribute") - query = qgep_session.query(QGEP.measurement_series) + query = qgep_session.query(qgep_model.measurement_series) if filtered: query = query.join( - QGEP.measuring_point, QGEP.wastewater_structure, QGEP.wastewater_networkelement - ).filter(QGEP.wastewater_networkelement.obj_id.in_(subset_ids)) + qgep_model.measuring_point, + qgep_model.wastewater_structure, + qgep_model.wastewater_networkelement, + ).filter(qgep_model.wastewater_networkelement.obj_id.in_(subset_ids)) # QGEP.wastewater_networkelement, # or_( # (QGEP.measuring_point, QGEP.waste_water_treatment_plant, QGEP.wastewater_networkelement), @@ -3002,7 +2581,7 @@ def overflow_common(row): # --- _rel_ --- # to do add relations fk_dataowner__REL, fk_provider__REL, profile_type__REL - messreihe = ABWASSER.messreihe( + messreihe = abwasser_model.messreihe( # FIELDS TO MAP TO ABWASSER.messreihe # --- baseclass --- # --- sia405_baseclass --- @@ -3027,14 +2606,14 @@ def overflow_common(row): logger.info( "Exporting QGEP.measurement_result -> ABWASSER.messresultat, ABWASSER.metaattribute" ) - query = qgep_session.query(QGEP.measurement_result) + query = qgep_session.query(qgep_model.measurement_result) if filtered: query = query.join( - QGEP.measurement_series, - QGEP.measuring_point, - QGEP.wastewater_structure, - QGEP.wastewater_networkelement, - ).filter(QGEP.wastewater_networkelement.obj_id.in_(subset_ids)) + qgep_model.measurement_series, + qgep_model.measuring_point, + qgep_model.wastewater_structure, + qgep_model.wastewater_networkelement, + ).filter(qgep_model.wastewater_networkelement.obj_id.in_(subset_ids)) # or_( # (QGEP.measurement_series, QGEP.measuring_point, QGEP.waste_water_treatment_plant, QGEP.wastewater_networkelement), # (QGEP.measurement_series, QGEP.measuring_point, QGEP.wastewater_structure, QGEP.wastewater_networkelement), @@ -3057,7 +2636,7 @@ def overflow_common(row): # --- _rel_ --- # to do add relations fk_dataowner__REL, fk_provider__REL, profile_type__REL - messresultat = ABWASSER.messresultat( + messresultat = abwasser_model.messresultat( # FIELDS TO MAP TO ABWASSER.messresultat # --- baseclass --- # --- sia405_baseclass --- @@ -3083,16 +2662,17 @@ def overflow_common(row): logger.info( "Exporting QGEP.throttle_shut_off_unit -> ABWASSER.absperr_drosselorgan, ABWASSER.metaattribute" ) - query = qgep_session.query(QGEP.throttle_shut_off_unit) + query = qgep_session.query(qgep_model.throttle_shut_off_unit) # sqlalchemy.exc.InvalidRequestError: Don't know how to join to . Please use the .select_from() method to establish an explicit left side, as well as providing an explcit ON clause if not present already to help resolve the ambiguity. # fk_control_center has also to be NOT considered if filtered: query = query.join( - QGEP.wastewater_node, + qgep_model.wastewater_node, or_( - QGEP.wastewater_node.obj_id == QGEP.throttle_shut_off_unit.fk_wastewater_node, + qgep_model.wastewater_node.obj_id + == qgep_model.throttle_shut_off_unit.fk_wastewater_node, ), - ).filter(QGEP.wastewater_networkelement.obj_id.in_(subset_ids)) + ).filter(qgep_model.wastewater_networkelement.obj_id.in_(subset_ids)) for row in query: # AVAILABLE FIELDS IN QGEP.throttle_shut_off_unit @@ -3105,7 +2685,7 @@ def overflow_common(row): # --- _rel_ --- # to do add relations fk_dataowner__REL, fk_provider__REL, profile_type__REL - absperr_drosselorgan = ABWASSER.absperr_drosselorgan( + absperr_drosselorgan = abwasser_model.absperr_drosselorgan( # FIELDS TO MAP TO ABWASSER.absperr_drosselorgan # --- baseclass --- # --- sia405_baseclass --- @@ -3138,16 +2718,16 @@ def overflow_common(row): abwasser_session.flush() logger.info("Exporting QGEP.prank_weir -> ABWASSER.streichwehr, ABWASSER.metaattribute") - query = qgep_session.query(QGEP.prank_weir) + query = qgep_session.query(qgep_model.prank_weir) # to check if fk_overflow_char also has to be considered if filtered: query = query.join( - QGEP.wastewater_node, + qgep_model.wastewater_node, or_( - QGEP.wastewater_node.obj_id == QGEP.prank_weir.fk_wastewater_node, - QGEP.wastewater_node.obj_id == QGEP.prank_weir.fk_overflow_to, + qgep_model.wastewater_node.obj_id == qgep_model.prank_weir.fk_wastewater_node, + qgep_model.wastewater_node.obj_id == qgep_model.prank_weir.fk_overflow_to, ), - ).filter(QGEP.wastewater_networkelement.obj_id.in_(subset_ids)) + ).filter(qgep_model.wastewater_networkelement.obj_id.in_(subset_ids)) for row in query: # AVAILABLE FIELDS IN QGEP.prank_weir @@ -3163,7 +2743,7 @@ def overflow_common(row): # --- _rel_ --- # to do extra funktion schreiben wo alle fk auf diese klasse erzeugt werden z.B. # accessibility__REL, bedding_encasement__REL, - streichwehr = ABWASSER.streichwehr( + streichwehr = abwasser_model.streichwehr( # FIELDS TO MAP TO ABWASSER.streichwehr # --- baseclass --- # --- sia405_baseclass --- @@ -3184,16 +2764,16 @@ def overflow_common(row): abwasser_session.flush() logger.info("Exporting QGEP.pump -> ABWASSER.foerderaggregat, ABWASSER.metaattribute") - query = qgep_session.query(QGEP.pump) + query = qgep_session.query(qgep_model.pump) # to check if fk_overflow_char also has to be considered if filtered: query = query.join( - QGEP.wastewater_node, + qgep_model.wastewater_node, or_( - QGEP.wastewater_node.obj_id == QGEP.prank_weir.fk_wastewater_node, - QGEP.wastewater_node.obj_id == QGEP.prank_weir.fk_overflow_to, + qgep_model.wastewater_node.obj_id == qgep_model.prank_weir.fk_wastewater_node, + qgep_model.wastewater_node.obj_id == qgep_model.prank_weir.fk_overflow_to, ), - ).filter(QGEP.wastewater_networkelement.obj_id.in_(subset_ids)) + ).filter(qgep_model.wastewater_networkelement.obj_id.in_(subset_ids)) for row in query: # AVAILABLE FIELDS IN QGEP.pump @@ -3209,7 +2789,7 @@ def overflow_common(row): # --- _rel_ --- # to do extra funktion schreiben wo alle fk auf diese klasse erzeugt werden z.B. # accessibility__REL, bedding_encasement__REL, - foerderaggregat = ABWASSER.foerderaggregat( + foerderaggregat = abwasser_model.foerderaggregat( # FIELDS TO MAP TO ABWASSER.foerderaggregat # --- baseclass --- # --- sia405_baseclass --- @@ -3234,16 +2814,16 @@ def overflow_common(row): abwasser_session.flush() logger.info("Exporting QGEP.leapingweir -> ABWASSER.leapingwehr, ABWASSER.metaattribute") - query = qgep_session.query(QGEP.leapingweir) + query = qgep_session.query(qgep_model.leapingweir) # to check if fk_overflow_char also has to be considered if filtered: query = query.join( - QGEP.wastewater_node, + qgep_model.wastewater_node, or_( - QGEP.wastewater_node.obj_id == QGEP.prank_weir.fk_wastewater_node, - QGEP.wastewater_node.obj_id == QGEP.prank_weir.fk_overflow_to, + qgep_model.wastewater_node.obj_id == qgep_model.prank_weir.fk_wastewater_node, + qgep_model.wastewater_node.obj_id == qgep_model.prank_weir.fk_overflow_to, ), - ).filter(QGEP.wastewater_networkelement.obj_id.in_(subset_ids)) + ).filter(qgep_model.wastewater_networkelement.obj_id.in_(subset_ids)) for row in query: # AVAILABLE FIELDS IN QGEP.leapingweir @@ -3259,7 +2839,7 @@ def overflow_common(row): # --- _rel_ --- # to do extra funktion schreiben wo alle fk auf diese klasse erzeugt werden z.B. # accessibility__REL, bedding_encasement__REL, - leapingwehr = ABWASSER.leapingwehr( + leapingwehr = abwasser_model.leapingwehr( # FIELDS TO MAP TO ABWASSER.leapingwehr # --- baseclass --- # --- sia405_baseclass --- @@ -3280,16 +2860,17 @@ def overflow_common(row): logger.info( "Exporting QGEP.hydraulic_char_data -> ABWASSER.hydr_kennwerte, ABWASSER.metaattribute" ) - query = qgep_session.query(QGEP.hydraulic_char_data) + query = qgep_session.query(qgep_model.hydraulic_char_data) # side fk_overflow_char not considered in filter query if filtered: query = query.join( - QGEP.wastewater_node, + qgep_model.wastewater_node, or_( - QGEP.wastewater_node.obj_id == QGEP.hydraulic_char_data.fk_wastewater_node, + qgep_model.wastewater_node.obj_id + == qgep_model.hydraulic_char_data.fk_wastewater_node, # fk_primary_direction only added with VSA-DSS 2020 ), - ).filter(QGEP.wastewater_networkelement.obj_id.in_(subset_ids)) + ).filter(qgep_model.wastewater_networkelement.obj_id.in_(subset_ids)) for row in query: # AVAILABLE FIELDS IN QGEP.hydraulic_char_data @@ -3302,7 +2883,7 @@ def overflow_common(row): # --- _rel_ --- # to do add relations fk_dataowner__REL, fk_provider__REL, profile_type__REL - hydr_kennwerte = ABWASSER.hydr_kennwerte( + hydr_kennwerte = abwasser_model.hydr_kennwerte( # FIELDS TO MAP TO ABWASSER.hydr_kennwerte # --- baseclass --- # --- sia405_baseclass --- @@ -3341,12 +2922,12 @@ def overflow_common(row): logger.info( "Exporting QGEP.backflow_prevention -> ABWASSER.rueckstausicherung, ABWASSER.metaattribute" ) - query = qgep_session.query(QGEP.backflow_prevention) + query = qgep_session.query(qgep_model.backflow_prevention) # side fk_throttle_shut_off_unit and fk_overflow not considered in filter query - they are usually added only for log_cards and then the corresponding nodes exist anyway thru the direct relation. if filtered: - query = query.join(QGEP.wastewater_structure, QGEP.wastewater_networkelement).filter( - QGEP.wastewater_networkelement.obj_id.in_(subset_ids) - ) + query = query.join( + qgep_model.wastewater_structure, qgep_model.wastewater_networkelement + ).filter(qgep_model.wastewater_networkelement.obj_id.in_(subset_ids)) for row in query: # AVAILABLE FIELDS IN QGEP.backflow_prevention @@ -3362,7 +2943,7 @@ def overflow_common(row): # --- _rel_ --- # to do extra funktion schreiben wo alle fk auf diese klasse erzeugt werden z.B. # accessibility__REL, bedding_encasement__REL, - rueckstausicherung = ABWASSER.rueckstausicherung( + rueckstausicherung = abwasser_model.rueckstausicherung( # FIELDS TO MAP TO ABWASSER.rueckstausicherung # --- baseclass --- # --- sia405_baseclass --- @@ -3385,11 +2966,11 @@ def overflow_common(row): logger.info( "Exporting QGEP.solids_retention -> ABWASSER.feststoffrueckhalt, ABWASSER.metaattribute" ) - query = qgep_session.query(QGEP.solids_retention) + query = qgep_session.query(qgep_model.solids_retention) if filtered: - query = query.join(QGEP.wastewater_structure, QGEP.wastewater_networkelement).filter( - QGEP.wastewater_networkelement.obj_id.in_(subset_ids) - ) + query = query.join( + qgep_model.wastewater_structure, qgep_model.wastewater_networkelement + ).filter(qgep_model.wastewater_networkelement.obj_id.in_(subset_ids)) for row in query: # AVAILABLE FIELDS IN QGEP.solids_retention @@ -3405,7 +2986,7 @@ def overflow_common(row): # --- _rel_ --- # to do extra funktion schreiben wo alle fk auf diese klasse erzeugt werden z.B. # accessibility__REL, bedding_encasement__REL, - feststoffrueckhalt = ABWASSER.feststoffrueckhalt( + feststoffrueckhalt = abwasser_model.feststoffrueckhalt( # FIELDS TO MAP TO ABWASSER.feststoffrueckhalt # --- baseclass --- # --- sia405_baseclass --- @@ -3426,11 +3007,11 @@ def overflow_common(row): abwasser_session.flush() logger.info("Exporting QGEP.tank_cleaning -> ABWASSER.beckenreinigung, ABWASSER.metaattribute") - query = qgep_session.query(QGEP.tank_cleaning) + query = qgep_session.query(qgep_model.tank_cleaning) if filtered: - query = query.join(QGEP.wastewater_structure, QGEP.wastewater_networkelement).filter( - QGEP.wastewater_networkelement.obj_id.in_(subset_ids) - ) + query = query.join( + qgep_model.wastewater_structure, qgep_model.wastewater_networkelement + ).filter(qgep_model.wastewater_networkelement.obj_id.in_(subset_ids)) for row in query: # AVAILABLE FIELDS IN QGEP.tank_cleaning @@ -3446,7 +3027,7 @@ def overflow_common(row): # --- _rel_ --- # to do extra funktion schreiben wo alle fk auf diese klasse erzeugt werden z.B. # accessibility__REL, bedding_encasement__REL, - beckenreinigung = ABWASSER.beckenreinigung( + beckenreinigung = abwasser_model.beckenreinigung( # FIELDS TO MAP TO ABWASSER.beckenreinigung # --- baseclass --- # --- sia405_baseclass --- @@ -3467,12 +3048,12 @@ def overflow_common(row): logger.info( "Exporting QGEP.tank_emptying -> ABWASSER.beckenentleerung, ABWASSER.metaattribute" ) - query = qgep_session.query(QGEP.tank_emptying) + query = qgep_session.query(qgep_model.tank_emptying) # side fk_throttle_shut_off_unit and fk_overflow not considered in filter query - they are usually added only for log_cards and then the corresponding nodes exist anyway thru the direct relation. if filtered: - query = query.join(QGEP.wastewater_structure, QGEP.wastewater_networkelement).filter( - QGEP.wastewater_networkelement.obj_id.in_(subset_ids) - ) + query = query.join( + qgep_model.wastewater_structure, qgep_model.wastewater_networkelement + ).filter(qgep_model.wastewater_networkelement.obj_id.in_(subset_ids)) for row in query: # AVAILABLE FIELDS IN QGEP.tank_emptying @@ -3488,7 +3069,7 @@ def overflow_common(row): # --- _rel_ --- # to do extra funktion schreiben wo alle fk auf diese klasse erzeugt werden z.B. # accessibility__REL, bedding_encasement__REL, - beckenentleerung = ABWASSER.beckenentleerung( + beckenentleerung = abwasser_model.beckenentleerung( # FIELDS TO MAP TO ABWASSER.beckenentleerung # --- baseclass --- # --- sia405_baseclass --- @@ -3512,10 +3093,10 @@ def overflow_common(row): logger.info( "Exporting QGEP.param_ca_general -> ABWASSER.ezg_parameter_allg, ABWASSER.metaattribute" ) - query = qgep_session.query(QGEP.param_ca_general) + query = qgep_session.query(qgep_model.param_ca_general) if filtered: - query = query.join(QGEP.catchment_area).filter( - QGEP.wastewater_networkelement.obj_id.in_(subset_ids) + query = query.join(qgep_model.catchment_area).filter( + qgep_model.wastewater_networkelement.obj_id.in_(subset_ids) ) for row in query: # AVAILABLE FIELDS IN QGEP.param_ca_general @@ -3532,7 +3113,7 @@ def overflow_common(row): # --- _rel_ --- # to do extra funktion schreiben wo alle fk auf diese klasse erzeugt werden z.B. # accessibility__REL, bedding_encasement__REL, - ezg_parameter_allg = ABWASSER.ezg_parameter_allg( + ezg_parameter_allg = abwasser_model.ezg_parameter_allg( # FIELDS TO MAP TO ABWASSER.ezg_parameter_allg # --- baseclass --- # --- sia405_baseclass --- @@ -3555,10 +3136,10 @@ def overflow_common(row): logger.info( "Exporting QGEP.param_ca_mouse1 -> ABWASSER.ezg_parameter_mouse1, ABWASSER.metaattribute" ) - query = qgep_session.query(QGEP.param_ca_mouse1) + query = qgep_session.query(qgep_model.param_ca_mouse1) if filtered: - query = query.join(QGEP.catchment_area).filter( - QGEP.wastewater_networkelement.obj_id.in_(subset_ids) + query = query.join(qgep_model.catchment_area).filter( + qgep_model.wastewater_networkelement.obj_id.in_(subset_ids) ) for row in query: # AVAILABLE FIELDS IN QGEP.param_ca_mouse1 @@ -3575,7 +3156,7 @@ def overflow_common(row): # --- _rel_ --- # to do extra funktion schreiben wo alle fk auf diese klasse erzeugt werden z.B. # accessibility__REL, bedding_encasement__REL, - ezg_parameter_mouse1 = ABWASSER.ezg_parameter_mouse1( + ezg_parameter_mouse1 = abwasser_model.ezg_parameter_mouse1( # FIELDS TO MAP TO ABWASSER.ezg_parameter_mouse1 # --- baseclass --- # --- sia405_baseclass --- @@ -3600,14 +3181,14 @@ def overflow_common(row): logger.info( "Exporting QGEP.maintenance_event -> ABWASSER.maintenance_event, ABWASSER.metaattribute" ) - query = qgep_session.query(QGEP.maintenance_event) + query = qgep_session.query(qgep_model.maintenance_event) # to check if join is correct like this n:m re_maintenance_event_wastewater_structure if filtered: query = query.join( - QGEP.re_maintenance_event_wastewater_structure, - QGEP.wastewater_structure, - QGEP.wastewater_networkelement, - ).filter(QGEP.wastewater_networkelement.obj_id.in_(subset_ids)) + qgep_model.re_maintenance_event_wastewater_structure, + qgep_model.wastewater_structure, + qgep_model.wastewater_networkelement, + ).filter(qgep_model.wastewater_networkelement.obj_id.in_(subset_ids)) for row in query: # AVAILABLE FIELDS IN QGEP.maintenance_event @@ -3619,7 +3200,7 @@ def overflow_common(row): # --- _rel_ --- # to do add relations fk_dataowner__REL, fk_provider__REL, profile_type__REL - erhaltungsereignis = ABWASSER.erhaltungsereignis( + erhaltungsereignis = abwasser_model.erhaltungsereignis( # FIELDS TO MAP TO ABWASSER.erhaltungsereignis # --- baseclass --- # --- sia405_baseclass --- @@ -3669,11 +3250,11 @@ def overflow_common(row): "abwasserbauwerk": {}, "einzugsgebiet": {}, } - for row in abwasser_session.query(ABWASSER.haltung): + for row in abwasser_session.query(abwasser_model.haltung): tid_for_obj_id["haltung"][row.obj_id] = row.t_id - for row in abwasser_session.query(ABWASSER.abwasserbauwerk): + for row in abwasser_session.query(abwasser_model.abwasserbauwerk): tid_for_obj_id["abwasserbauwerk"][row.obj_id] = row.t_id - for row in abwasser_session.query(ABWASSER.einzugsgebiet): + for row in abwasser_session.query(abwasser_model.einzugsgebiet): tid_for_obj_id["einzugsgebiet"][row.obj_id] = row.t_id with open(labels_file) as labels_file_handle: @@ -3702,7 +3283,7 @@ def overflow_common(row): f"Label for haltung (reach) `{obj_id}` exists, but that object is not part of the export" ) continue - ili_label = ABWASSER.haltung_text( + ili_label = abwasser_model.haltung_text( **qgep_export_utils.textpos_common( label, "haltung_text (reach_text)", geojson_crs_def ), @@ -3715,7 +3296,7 @@ def overflow_common(row): f"Label for abwasserbauwerk (wastewater_structure) `{obj_id}` exists, but that object is not part of the export" ) continue - ili_label = ABWASSER.abwasserbauwerk_text( + ili_label = abwasser_model.abwasserbauwerk_text( **qgep_export_utils.textpos_common( label, "abwasserbauwerk_text", geojson_crs_def ), @@ -3728,7 +3309,7 @@ def overflow_common(row): f"Label for einzugsgebiet (catchment_area) `{obj_id}` exists, but that object is not part of the export" ) continue - ili_label = ABWASSER.einzugsgebiet_text( + ili_label = abwasser_model.einzugsgebiet_text( **qgep_export_utils.textpos_common( label, "einzugsgebiet_text (catchment_area_text)", geojson_crs_def ), @@ -3760,11 +3341,11 @@ def overflow_common(row): logger.info( "Exporting QGEP.re_maintenance_event_wastewater_structure -> ABWASSER.erhaltungsereignis_abwasserbauwerkassoc" ) - query = qgep_session.query(QGEP.re_maintenance_event_wastewater_structure) + query = qgep_session.query(qgep_model.re_maintenance_event_wastewater_structure) if filtered: - query = query.join(QGEP.wastewater_structure, QGEP.wastewater_networkelement).filter( - QGEP.wastewater_networkelement.obj_id.in_(subset_ids) - ) + query = query.join( + qgep_model.wastewater_structure, qgep_model.wastewater_networkelement + ).filter(qgep_model.wastewater_networkelement.obj_id.in_(subset_ids)) for row in query: # AVAILABLE FIELDS IN QGEP.maintenance_event_wastewater_structure @@ -3777,7 +3358,7 @@ def overflow_common(row): # --- _rel_ --- # to do add relations fk_dataowner__REL, fk_provider__REL, profile_type__REL - erhaltungsereignis_abwasserbauwerk = ABWASSER.erhaltungsereignis_abwasserbauwerkassoc( + erhaltungsereignis_abwasserbauwerk = abwasser_model.erhaltungsereignis_abwasserbauwerkassoc( # FIELDS TO MAP TO ABWASSER.erhaltungsereignis_abwasserbauwerk # --- baseclass --- # --- sia405_baseclass --- diff --git a/qgepqwat2ili/qgepdss/import_.py b/qgepqwat2ili/qgepdss/import_.py index 537312a8..405d9c42 100644 --- a/qgepqwat2ili/qgepdss/import_.py +++ b/qgepqwat2ili/qgepdss/import_.py @@ -13,7 +13,7 @@ from .model_qgep import get_qgep_model -def qgep_import(precommit_callback=None): +def qgep_import_dss(precommit_callback=None): """ Imports data from the ili2pg model into the QGEP model. diff --git a/qgepqwat2ili/qgepsia405/export.py b/qgepqwat2ili/qgepsia405/export.py index 2c531945..e1e93382 100644 --- a/qgepqwat2ili/qgepsia405/export.py +++ b/qgepqwat2ili/qgepsia405/export.py @@ -1,7 +1,6 @@ import json from geoalchemy2.functions import ST_Force2D -from sqlalchemy import or_ from sqlalchemy.orm import Session from sqlalchemy.sql import text @@ -14,7 +13,7 @@ from .model_qgep import get_qgep_model -def qgep_export(selection=None, labels_file=None, orientation=None, basket_enabled=False): +def qgep_export_sia405(selection=None, labels_file=None, orientation=None, basket_enabled=False): """ Export data from the QGEP model into the ili2pg model. @@ -22,8 +21,8 @@ def qgep_export(selection=None, labels_file=None, orientation=None, basket_enabl selection: if provided, limits the export to networkelements that are provided in the selection """ - QGEP = get_qgep_model() - ABWASSER = get_abwasser_model() + qgep_model = get_qgep_model() + abwasser_model = get_abwasser_model() # Logging disabled (very slow) # qgep_session = Session(utils.sqlalchemy.create_engine(logger_name="qgep"), autocommit=False, autoflush=False) @@ -38,7 +37,7 @@ def qgep_export(selection=None, labels_file=None, orientation=None, basket_enabl basket_utils = None current_basket = None if basket_enabled: - basket_utils = BasketUtils(ABWASSER, abwasser_session) + basket_utils = BasketUtils(abwasser_model, abwasser_session) basket_utils.create_basket() current_basket = basket_utils.basket_topic_sia405_abwasser @@ -67,133 +66,29 @@ def qgep_export(selection=None, labels_file=None, orientation=None, basket_enabl tid_maker=tid_maker, current_basket=current_basket, abwasser_session=abwasser_session, - abwasser_model=ABWASSER, + abwasser_model=abwasser_model, + qgep_session=qgep_session, + qgep_model=qgep_model, labelorientation=labelorientation, + filtered=filtered, + subset_ids=subset_ids, ) # ADAPTED FROM 052a_sia405_abwasser_2015_2_d_interlisexport2.sql logger.info("Exporting QGEP.organisation -> ABWASSER.organisation, ABWASSER.metaattribute") - query = qgep_session.query(QGEP.organisation) - for row in query: - - # AVAILABLE FIELDS IN QGEP.organisation - - # --- organisation --- - # fk_dataowner, fk_provider, identifier, last_modification, obj_id, remark, uid - - # --- _bwrel_ --- - # accident__BWREL_fk_dataowner, accident__BWREL_fk_provider, administrative_office__BWREL_obj_id, aquifier__BWREL_fk_dataowner, aquifier__BWREL_fk_provider, bathing_area__BWREL_fk_dataowner, bathing_area__BWREL_fk_provider, canton__BWREL_obj_id, catchment_area__BWREL_fk_dataowner, catchment_area__BWREL_fk_provider, connection_object__BWREL_fk_dataowner, connection_object__BWREL_fk_operator, connection_object__BWREL_fk_owner, connection_object__BWREL_fk_provider, control_center__BWREL_fk_dataowner, control_center__BWREL_fk_provider, cooperative__BWREL_obj_id, damage__BWREL_fk_dataowner, damage__BWREL_fk_provider, data_media__BWREL_fk_dataowner, data_media__BWREL_fk_provider, file__BWREL_fk_dataowner, file__BWREL_fk_provider, fish_pass__BWREL_fk_dataowner, fish_pass__BWREL_fk_provider, hazard_source__BWREL_fk_dataowner, hazard_source__BWREL_fk_owner, hazard_source__BWREL_fk_provider, hq_relation__BWREL_fk_dataowner, hq_relation__BWREL_fk_provider, hydr_geom_relation__BWREL_fk_dataowner, hydr_geom_relation__BWREL_fk_provider, hydr_geometry__BWREL_fk_dataowner, hydr_geometry__BWREL_fk_provider, hydraulic_char_data__BWREL_fk_dataowner, hydraulic_char_data__BWREL_fk_provider, maintenance_event__BWREL_fk_dataowner, maintenance_event__BWREL_fk_operating_company, maintenance_event__BWREL_fk_provider, measurement_result__BWREL_fk_dataowner, measurement_result__BWREL_fk_provider, measurement_series__BWREL_fk_dataowner, measurement_series__BWREL_fk_provider, measuring_device__BWREL_fk_dataowner, measuring_device__BWREL_fk_provider, measuring_point__BWREL_fk_dataowner, measuring_point__BWREL_fk_operator, measuring_point__BWREL_fk_provider, mechanical_pretreatment__BWREL_fk_dataowner, mechanical_pretreatment__BWREL_fk_provider, municipality__BWREL_obj_id, mutation__BWREL_fk_dataowner, mutation__BWREL_fk_provider, organisation__BWREL_fk_dataowner, organisation__BWREL_fk_provider, overflow__BWREL_fk_dataowner, overflow__BWREL_fk_provider, overflow_char__BWREL_fk_dataowner, overflow_char__BWREL_fk_provider, pipe_profile__BWREL_fk_dataowner, pipe_profile__BWREL_fk_provider, private__BWREL_obj_id, profile_geometry__BWREL_fk_dataowner, profile_geometry__BWREL_fk_provider, reach_point__BWREL_fk_dataowner, reach_point__BWREL_fk_provider, retention_body__BWREL_fk_dataowner, retention_body__BWREL_fk_provider, river_bank__BWREL_fk_dataowner, river_bank__BWREL_fk_provider, river_bed__BWREL_fk_dataowner, river_bed__BWREL_fk_provider, sector_water_body__BWREL_fk_dataowner, sector_water_body__BWREL_fk_provider, sludge_treatment__BWREL_fk_dataowner, sludge_treatment__BWREL_fk_provider, structure_part__BWREL_fk_dataowner, structure_part__BWREL_fk_provider, substance__BWREL_fk_dataowner, substance__BWREL_fk_provider, surface_runoff_parameters__BWREL_fk_dataowner, surface_runoff_parameters__BWREL_fk_provider, surface_water_bodies__BWREL_fk_dataowner, surface_water_bodies__BWREL_fk_provider, throttle_shut_off_unit__BWREL_fk_dataowner, throttle_shut_off_unit__BWREL_fk_provider, txt_symbol__BWREL_fk_dataowner, txt_symbol__BWREL_fk_provider, waste_water_association__BWREL_obj_id, waste_water_treatment__BWREL_fk_dataowner, waste_water_treatment__BWREL_fk_provider, waste_water_treatment_plant__BWREL_obj_id, wastewater_networkelement__BWREL_fk_dataowner, wastewater_networkelement__BWREL_fk_provider, wastewater_structure__BWREL_fk_dataowner, wastewater_structure__BWREL_fk_operator, wastewater_structure__BWREL_fk_owner, wastewater_structure__BWREL_fk_provider, wastewater_structure_symbol__BWREL_fk_dataowner, wastewater_structure_symbol__BWREL_fk_provider, water_catchment__BWREL_fk_dataowner, water_catchment__BWREL_fk_provider, water_control_structure__BWREL_fk_dataowner, water_control_structure__BWREL_fk_provider, water_course_segment__BWREL_fk_dataowner, water_course_segment__BWREL_fk_provider, wwtp_energy_use__BWREL_fk_dataowner, wwtp_energy_use__BWREL_fk_provider, zone__BWREL_fk_dataowner, zone__BWREL_fk_provider - - # --- _rel_ --- - # fk_dataowner__REL, fk_provider__REL - - organisation = ABWASSER.organisation( - # FIELDS TO MAP TO ABWASSER.organisation - # --- baseclass --- - # --- sia405_baseclass --- - **qgep_export_utils.base_common(row, "organisation"), - # --- organisation --- - auid=row.uid, - bemerkung=qgep_export_utils.truncate( - qgep_export_utils.emptystr_to_null(row.remark), 80 - ), - bezeichnung=qgep_export_utils.null_to_emptystr(row.identifier), - ) - abwasser_session.add(organisation) - qgep_export_utils.create_metaattributes(row) - print(".", end="") - logger.info("done") - abwasser_session.flush() + qgep_export_utils.export_organisation() logger.info("Exporting QGEP.channel -> ABWASSER.kanal, ABWASSER.metaattribute") - query = qgep_session.query(QGEP.channel) - if filtered: - query = query.join(QGEP.wastewater_networkelement).filter( - QGEP.wastewater_networkelement.obj_id.in_(subset_ids) - ) - for row in query: - # AVAILABLE FIELDS IN QGEP.channel - - # --- wastewater_structure --- - # _bottom_label, _cover_label, _depth, _function_hierarchic, _input_label, _label, _output_label, _usage_current, accessibility, contract_section, detail_geometry_geometry, financing, fk_dataowner, fk_main_cover, fk_main_wastewater_node, fk_operator, fk_owner, fk_provider, gross_costs, identifier, inspection_interval, last_modification, location_name, records, remark, renovation_necessity, replacement_value, rv_base_year, rv_construction_type, status, structure_condition, subsidies, year_of_construction, year_of_replacement - - # --- _bwrel_ --- - # measuring_point__BWREL_fk_wastewater_structure, mechanical_pretreatment__BWREL_fk_wastewater_structure, re_maintenance_event_wastewater_structure__BWREL_fk_wastewater_structure, structure_part__BWREL_fk_wastewater_structure, txt_symbol__BWREL_fk_wastewater_structure, txt_text__BWREL_fk_wastewater_structure, wastewater_networkelement__BWREL_fk_wastewater_structure, wastewater_structure_symbol__BWREL_fk_wastewater_structure, wastewater_structure_text__BWREL_fk_wastewater_structure, wwtp_structure_kind__BWREL_obj_id - - # --- _rel_ --- - # accessibility__REL, bedding_encasement__REL, connection_type__REL, financing__REL, fk_dataowner__REL, fk_main_cover__REL, fk_main_wastewater_node__REL, fk_operator__REL, fk_owner__REL, fk_provider__REL, function_hierarchic__REL, function_hydraulic__REL, renovation_necessity__REL, rv_construction_type__REL, status__REL, structure_condition__REL, usage_current__REL, usage_planned__REL - - kanal = ABWASSER.kanal( - # FIELDS TO MAP TO ABWASSER.kanal - # --- baseclass --- - # --- sia405_baseclass --- - **qgep_export_utils.base_common(row, "kanal"), - # --- abwasserbauwerk --- - **qgep_export_utils.wastewater_structure_common(row), - # --- kanal --- - bettung_umhuellung=qgep_export_utils.get_vl(row.bedding_encasement__REL), - funktionhierarchisch=qgep_export_utils.get_vl(row.function_hierarchic__REL), - funktionhydraulisch=qgep_export_utils.get_vl(row.function_hydraulic__REL), - nutzungsart_geplant=qgep_export_utils.get_vl(row.usage_planned__REL), - nutzungsart_ist=qgep_export_utils.get_vl(row.usage_current__REL), - rohrlaenge=row.pipe_length, - spuelintervall=row.jetting_interval, - verbindungsart=qgep_export_utils.get_vl(row.connection_type__REL), - ) - abwasser_session.add(kanal) - qgep_export_utils.create_metaattributes(row) - print(".", end="") - logger.info("done") - abwasser_session.flush() + qgep_export_utils.export_channel() logger.info("Exporting QGEP.manhole -> ABWASSER.normschacht, ABWASSER.metaattribute") - query = qgep_session.query(QGEP.manhole) - if filtered: - query = query.join(QGEP.wastewater_networkelement).filter( - QGEP.wastewater_networkelement.obj_id.in_(subset_ids) - ) - for row in query: - # AVAILABLE FIELDS IN QGEP.manhole - - # --- wastewater_structure --- - # to do attributeslist of superclass - # --- manhole --- - # to do attributeslist of subclass - # to do extra funktion schreiben wo alle englischen attribute erzeugt werden - - # --- _bwrel_ --- - # to do extra funktion schreiben wo alle fk auf diese superklasse erzeugt werden z.B. # measuring_point__BWREL_fk_wastewater_structure, - - # --- _rel_ --- - # to do extra funktion schreiben wo alle fk auf diese klasse erzeugt werden z.B. # accessibility__REL, bedding_encasement__REL, - - normschacht = ABWASSER.normschacht( - # FIELDS TO MAP TO ABWASSER.normschacht - # --- baseclass --- - # --- sia405_baseclass --- - **qgep_export_utils.base_common(row, "normschacht"), - # --- abwasserbauwerk --- - **qgep_export_utils.wastewater_structure_common(row), - # --- normschacht --- - dimension1=row.dimension1, - dimension2=row.dimension2, - funktion=qgep_export_utils.get_vl(row.function__REL), - # -- attribute 3D --- - # maechtigkeit=row.depth, - material=qgep_export_utils.get_vl(row.material__REL), - oberflaechenzulauf=qgep_export_utils.get_vl(row.surface_inflow__REL), - ) - abwasser_session.add(normschacht) - qgep_export_utils.create_metaattributes(row) - print(".", end="") - logger.info("done") - abwasser_session.flush() + qgep_export_utils.export_manhole() logger.info("Exporting QGEP.discharge_point -> ABWASSER.einleitstelle, ABWASSER.metaattribute") - query = qgep_session.query(QGEP.discharge_point) + query = qgep_session.query(qgep_model.discharge_point) if filtered: - query = query.join(QGEP.wastewater_networkelement).filter( - QGEP.wastewater_networkelement.obj_id.in_(subset_ids) + query = query.join(qgep_model.wastewater_networkelement).filter( + qgep_model.wastewater_networkelement.obj_id.in_(subset_ids) ) for row in query: # AVAILABLE FIELDS IN QGEP.discharge_point @@ -210,7 +105,7 @@ def qgep_export(selection=None, labels_file=None, orientation=None, basket_enabl # --- _rel_ --- # to do extra funktion schreiben wo alle fk auf diese klasse erzeugt werden z.B. # accessibility__REL, bedding_encasement__REL, - einleitstelle = ABWASSER.einleitstelle( + einleitstelle = abwasser_model.einleitstelle( # FIELDS TO MAP TO ABWASSER.einleitstelle # --- baseclass --- # --- sia405_baseclass --- @@ -234,55 +129,15 @@ def qgep_export(selection=None, labels_file=None, orientation=None, basket_enabl logger.info( "Exporting QGEP.special_structure -> ABWASSER.spezialbauwerk, ABWASSER.metaattribute" ) - query = qgep_session.query(QGEP.special_structure) - if filtered: - query = query.join(QGEP.wastewater_networkelement).filter( - QGEP.wastewater_networkelement.obj_id.in_(subset_ids) - ) - for row in query: - # AVAILABLE FIELDS IN QGEP.special_structure - - # --- wastewater_structure --- - # _bottom_label, _cover_label, _depth, _function_hierarchic, _input_label, _label, _output_label, _usage_current, accessibility, contract_section, detail_geometry_geometry, financing, fk_dataowner, fk_main_cover, fk_main_wastewater_node, fk_operator, fk_owner, fk_provider, gross_costs, identifier, inspection_interval, last_modification, location_name, records, remark, renovation_necessity, replacement_value, rv_base_year, rv_construction_type, status, structure_condition, subsidies, year_of_construction, year_of_replacement - - # --- special_structure --- - # bypass, emergency_spillway, function, obj_id, stormwater_tank_arrangement, upper_elevation - - # --- _bwrel_ --- - # measuring_point__BWREL_fk_wastewater_structure, mechanical_pretreatment__BWREL_fk_wastewater_structure, re_maintenance_event_wastewater_structure__BWREL_fk_wastewater_structure, structure_part__BWREL_fk_wastewater_structure, txt_symbol__BWREL_fk_wastewater_structure, txt_text__BWREL_fk_wastewater_structure, wastewater_networkelement__BWREL_fk_wastewater_structure, wastewater_structure_symbol__BWREL_fk_wastewater_structure, wastewater_structure_text__BWREL_fk_wastewater_structure, wwtp_structure_kind__BWREL_obj_id - - # --- _rel_ --- - # accessibility__REL, bypass__REL, emergency_spillway__REL, financing__REL, fk_dataowner__REL, fk_main_cover__REL, fk_main_wastewater_node__REL, fk_operator__REL, fk_owner__REL, fk_provider__REL, function__REL, renovation_necessity__REL, rv_construction_type__REL, status__REL, stormwater_tank_arrangement__REL, structure_condition__REL - - # QGEP field special_structure.upper_elevation is a 3D attribute and has no equivalent in the INTERLIS 2D model release used. It will be ignored for now and not supported with QGEP. - - spezialbauwerk = ABWASSER.spezialbauwerk( - # FIELDS TO MAP TO ABWASSER.spezialbauwerk - # --- baseclass --- - # --- sia405_baseclass --- - **qgep_export_utils.base_common(row, "spezialbauwerk"), - # --- abwasserbauwerk --- - **qgep_export_utils.wastewater_structure_common(row), - # --- spezialbauwerk --- - # TODO : WARNING : upper_elevation is not mapped - bypass=qgep_export_utils.get_vl(row.bypass__REL), - funktion=qgep_export_utils.get_vl(row.function__REL), - notueberlauf=qgep_export_utils.get_vl(row.emergency_spillway__REL), - regenbecken_anordnung=qgep_export_utils.get_vl(row.stormwater_tank_arrangement__REL), - ) - abwasser_session.add(spezialbauwerk) - qgep_export_utils.create_metaattributes(row) - print(".", end="") - logger.info("done") - abwasser_session.flush() + qgep_export_utils.export_special_structure() logger.info( "Exporting QGEP.infiltration_installation -> ABWASSER.versickerungsanlage, ABWASSER.metaattribute" ) - query = qgep_session.query(QGEP.infiltration_installation) + query = qgep_session.query(qgep_model.infiltration_installation) if filtered: - query = query.join(QGEP.wastewater_networkelement).filter( - QGEP.wastewater_networkelement.obj_id.in_(subset_ids) + query = query.join(qgep_model.wastewater_networkelement).filter( + qgep_model.wastewater_networkelement.obj_id.in_(subset_ids) ) for row in query: # AVAILABLE FIELDS IN QGEP.infiltration_installation @@ -302,7 +157,7 @@ def qgep_export(selection=None, labels_file=None, orientation=None, basket_enabl logger.warning( "QGEP field infiltration_installation.upper_elevation has no equivalent in the interlis model. It will be ignored." ) - versickerungsanlage = ABWASSER.versickerungsanlage( + versickerungsanlage = abwasser_model.versickerungsanlage( # FIELDS TO MAP TO ABWASSER.versickerungsanlage # --- baseclass --- # --- sia405_baseclass --- @@ -331,99 +186,17 @@ def qgep_export(selection=None, labels_file=None, orientation=None, basket_enabl abwasser_session.flush() logger.info("Exporting QGEP.pipe_profile -> ABWASSER.rohrprofil, ABWASSER.metaattribute") - query = qgep_session.query(QGEP.pipe_profile) - if filtered: - query = query.join(QGEP.reach).filter( - QGEP.wastewater_networkelement.obj_id.in_(subset_ids) - ) - for row in query: - - # AVAILABLE FIELDS IN QGEP.pipe_profile - - # --- pipe_profile --- - # fk_dataowner, fk_provider, height_width_ratio, identifier, last_modification, obj_id, profile_type, remark - - # --- _bwrel_ --- - # profile_geometry__BWREL_fk_pipe_profile, reach__BWREL_fk_pipe_profile - - # --- _rel_ --- - # fk_dataowner__REL, fk_provider__REL, profile_type__REL - - rohrprofil = ABWASSER.rohrprofil( - # FIELDS TO MAP TO ABWASSER.rohrprofil - # --- baseclass --- - # --- sia405_baseclass --- - **qgep_export_utils.base_common(row, "rohrprofil"), - # --- rohrprofil --- - bemerkung=qgep_export_utils.truncate( - qgep_export_utils.emptystr_to_null(row.remark), 80 - ), - bezeichnung=qgep_export_utils.null_to_emptystr(row.identifier), - hoehenbreitenverhaeltnis=row.height_width_ratio, - profiltyp=qgep_export_utils.get_vl(row.profile_type__REL), - ) - abwasser_session.add(rohrprofil) - qgep_export_utils.create_metaattributes(row) - print(".", end="") - logger.info("done") - abwasser_session.flush() + qgep_export_utils.export_pipe_profile() logger.info("Exporting QGEP.reach_point -> ABWASSER.haltungspunkt, ABWASSER.metaattribute") - query = qgep_session.query(QGEP.reach_point) - if filtered: - query = query.join( - QGEP.reach, - or_( - QGEP.reach_point.obj_id == QGEP.reach.fk_reach_point_from, - QGEP.reach_point.obj_id == QGEP.reach.fk_reach_point_to, - ), - ).filter(QGEP.wastewater_networkelement.obj_id.in_(subset_ids)) - for row in query: - - # AVAILABLE FIELDS IN QGEP.reach_point - - # --- reach_point --- - # elevation_accuracy, fk_dataowner, fk_provider, fk_wastewater_networkelement, identifier, last_modification, level, obj_id, outlet_shape, position_of_connection, remark, situation_geometry - - # --- _bwrel_ --- - # examination__BWREL_fk_reach_point, reach__BWREL_fk_reach_point_from, reach__BWREL_fk_reach_point_to - - # --- _rel_ --- - # elevation_accuracy__REL, fk_dataowner__REL, fk_provider__REL, fk_wastewater_networkelement__REL, outlet_shape__REL - - haltungspunkt = ABWASSER.haltungspunkt( - # FIELDS TO MAP TO ABWASSER.haltungspunkt - # --- baseclass --- - # --- sia405_baseclass --- - **qgep_export_utils.base_common(row, "haltungspunkt"), - # --- haltungspunkt --- - # changed call from qgep_export_utils.get_tid to qgep_export_utils.check_fk_in_subsetid so it does not wirte foreignkeys on elements that do not exist - # abwassernetzelementref=qgep_export_utils.get_tid(row.fk_wastewater_networkelement__REL), - abwassernetzelementref=qgep_export_utils.check_fk_in_subsetid( - subset_ids, row.fk_wastewater_networkelement__REL, filtered - ), - auslaufform=qgep_export_utils.get_vl(row.outlet_shape__REL), - bemerkung=qgep_export_utils.truncate( - qgep_export_utils.emptystr_to_null(row.remark), 80 - ), - bezeichnung=qgep_export_utils.null_to_emptystr(row.identifier), - hoehengenauigkeit=qgep_export_utils.get_vl(row.elevation_accuracy__REL), - kote=row.level, - lage=ST_Force2D(row.situation_geometry), - lage_anschluss=row.position_of_connection, - ) - abwasser_session.add(haltungspunkt) - qgep_export_utils.create_metaattributes(row) - print(".", end="") - logger.info("done") - abwasser_session.flush() + qgep_export_utils.export_reach_point() logger.info( "Exporting QGEP.wastewater_node -> ABWASSER.abwasserknoten, ABWASSER.metaattribute" ) - query = qgep_session.query(QGEP.wastewater_node) + query = qgep_session.query(qgep_model.wastewater_node) if filtered: - query = query.filter(QGEP.wastewater_networkelement.obj_id.in_(subset_ids)) + query = query.filter(qgep_model.wastewater_networkelement.obj_id.in_(subset_ids)) for row in query: # AVAILABLE FIELDS IN QGEP.wastewater_node @@ -440,7 +213,7 @@ def qgep_export(selection=None, labels_file=None, orientation=None, basket_enabl # QGEP field wastewater_node.fk_hydr_geometry has no equivalent in the interlis model. It will be ignored. - abwasserknoten = ABWASSER.abwasserknoten( + abwasserknoten = abwasser_model.abwasserknoten( # FIELDS TO MAP TO ABWASSER.abwasserknoten # --- baseclass --- # --- sia405_baseclass --- @@ -460,258 +233,26 @@ def qgep_export(selection=None, labels_file=None, orientation=None, basket_enabl abwasser_session.flush() logger.info("Exporting QGEP.reach -> ABWASSER.haltung, ABWASSER.metaattribute") - query = qgep_session.query(QGEP.reach) - if filtered: - query = query.filter(QGEP.wastewater_networkelement.obj_id.in_(subset_ids)) - for row in query: - # AVAILABLE FIELDS IN QGEP.reach - - # --- wastewater_networkelement --- - # fk_dataowner, fk_provider, fk_wastewater_structure, identifier, last_modification, remark - - # --- reach --- - # clear_height, coefficient_of_friction, elevation_determination, fk_pipe_profile, fk_reach_point_from, fk_reach_point_to, horizontal_positioning, inside_coating, length_effective, material, obj_id, progression_geometry, reliner_material, reliner_nominal_size, relining_construction, relining_kind, ring_stiffness, slope_building_plan, wall_roughness - - # --- _bwrel_ --- - # catchment_area__BWREL_fk_wastewater_networkelement_rw_current, catchment_area__BWREL_fk_wastewater_networkelement_rw_planned, catchment_area__BWREL_fk_wastewater_networkelement_ww_current, catchment_area__BWREL_fk_wastewater_networkelement_ww_planned, connection_object__BWREL_fk_wastewater_networkelement, reach_point__BWREL_fk_wastewater_networkelement, reach_text__BWREL_fk_reach, txt_text__BWREL_fk_reach - - # --- _rel_ --- - # elevation_determination__REL, fk_dataowner__REL, fk_pipe_profile__REL, fk_provider__REL, fk_reach_point_from__REL, fk_reach_point_to__REL, fk_wastewater_structure__REL, horizontal_positioning__REL, inside_coating__REL, material__REL, reliner_material__REL, relining_construction__REL, relining_kind__REL - - # QGEP field reach.elevation_determination has no equivalent in the interlis model. It will be ignored. - - haltung = ABWASSER.haltung( - # FIELDS TO MAP TO ABWASSER.haltung - # --- baseclass --- - # --- sia405_baseclass --- - **qgep_export_utils.base_common(row, "haltung"), - # --- abwassernetzelement --- - **qgep_export_utils.wastewater_networkelement_common(row), - # --- haltung --- - # NOT MAPPED : elevation_determination - innenschutz=qgep_export_utils.get_vl(row.inside_coating__REL), - laengeeffektiv=row.length_effective, - lagebestimmung=qgep_export_utils.get_vl(row.horizontal_positioning__REL), - lichte_hoehe=row.clear_height, - material=qgep_export_utils.get_vl(row.material__REL), - nachhaltungspunktref=qgep_export_utils.get_tid(row.fk_reach_point_to__REL), - plangefaelle=row.slope_building_plan, # TODO : check, does this need conversion ? - reibungsbeiwert=row.coefficient_of_friction, - reliner_art=qgep_export_utils.get_vl(row.relining_kind__REL), - reliner_bautechnik=qgep_export_utils.get_vl(row.relining_construction__REL), - reliner_material=qgep_export_utils.get_vl(row.reliner_material__REL), - reliner_nennweite=row.reliner_nominal_size, - ringsteifigkeit=row.ring_stiffness, - rohrprofilref=qgep_export_utils.get_tid(row.fk_pipe_profile__REL), - verlauf=ST_Force2D(row.progression_geometry), - # -- attribute 3D --- - # verlauf3d=row.progression3d, - vonhaltungspunktref=qgep_export_utils.get_tid(row.fk_reach_point_from__REL), - wandrauhigkeit=row.wall_roughness, - ) - abwasser_session.add(haltung) - qgep_export_utils.create_metaattributes(row) - print(".", end="") - logger.info("done") - abwasser_session.flush() + qgep_export_utils.export_reach() logger.info( "Exporting QGEP.dryweather_downspout -> ABWASSER.trockenwetterfallrohr, ABWASSER.metaattribute" ) - query = qgep_session.query(QGEP.dryweather_downspout) - if filtered: - query = query.join(QGEP.wastewater_structure, QGEP.wastewater_networkelement).filter( - QGEP.wastewater_networkelement.obj_id.in_(subset_ids) - ) - for row in query: - # AVAILABLE FIELDS IN QGEP.dryweather_downspout - - # --- structure_part --- - # fk_dataowner, fk_provider, fk_wastewater_structure, identifier, last_modification, remark, renovation_demand - - # --- dryweather_downspout --- - # diameter, obj_id - - # --- _bwrel_ --- - # access_aid_kind__BWREL_obj_id, backflow_prevention__BWREL_obj_id, benching_kind__BWREL_obj_id, dryweather_flume_material__BWREL_obj_id, electric_equipment__BWREL_obj_id, electromechanical_equipment__BWREL_obj_id, solids_retention__BWREL_obj_id, tank_cleaning__BWREL_obj_id, tank_emptying__BWREL_obj_id - - # --- _rel_ --- - # fk_dataowner__REL, fk_provider__REL, fk_wastewater_structure__REL, renovation_demand__REL - - trockenwetterfallrohr = ABWASSER.trockenwetterfallrohr( - # FIELDS TO MAP TO ABWASSER.trockenwetterfallrohr - # --- baseclass --- - # --- sia405_baseclass --- - **qgep_export_utils.base_common(row, "trockenwetterfallrohr"), - # --- bauwerksteil --- - **qgep_export_utils.structure_part_common(row), - # --- trockenwetterfallrohr --- - durchmesser=row.diameter, - ) - abwasser_session.add(trockenwetterfallrohr) - qgep_export_utils.create_metaattributes(row) - print(".", end="") - logger.info("done") - abwasser_session.flush() + qgep_export_utils.export_dryweather_downspout() logger.info("Exporting QGEP.access_aid -> ABWASSER.einstiegshilfe, ABWASSER.metaattribute") - query = qgep_session.query(QGEP.access_aid) - if filtered: - query = query.join(QGEP.wastewater_structure, QGEP.wastewater_networkelement).filter( - QGEP.wastewater_networkelement.obj_id.in_(subset_ids) - ) - for row in query: - # AVAILABLE FIELDS IN QGEP.access_aid - - # --- structure_part --- - # fk_dataowner, fk_provider, fk_wastewater_structure, identifier, last_modification, remark, renovation_demand - - # --- access_aid --- - # kind, obj_id - - # --- _bwrel_ --- - # access_aid_kind__BWREL_obj_id, backflow_prevention__BWREL_obj_id, benching_kind__BWREL_obj_id, dryweather_flume_material__BWREL_obj_id, electric_equipment__BWREL_obj_id, electromechanical_equipment__BWREL_obj_id, solids_retention__BWREL_obj_id, tank_cleaning__BWREL_obj_id, tank_emptying__BWREL_obj_id - - # --- _rel_ --- - # fk_dataowner__REL, fk_provider__REL, fk_wastewater_structure__REL, kind__REL, renovation_demand__REL - - einstiegshilfe = ABWASSER.einstiegshilfe( - # FIELDS TO MAP TO ABWASSER.einstiegshilfe - # --- baseclass --- - # --- sia405_baseclass --- - **qgep_export_utils.base_common(row, "einstiegshilfe"), - # --- bauwerksteil --- - **qgep_export_utils.structure_part_common(row), - # --- einstiegshilfe --- - art=qgep_export_utils.get_vl(row.kind__REL), - ) - abwasser_session.add(einstiegshilfe) - qgep_export_utils.create_metaattributes(row) - print(".", end="") - logger.info("done") - abwasser_session.flush() + qgep_export_utils.export_access_aid() logger.info( "Exporting QGEP.dryweather_flume -> ABWASSER.trockenwetterrinne, ABWASSER.metaattribute" ) - query = qgep_session.query(QGEP.dryweather_flume) - if filtered: - query = query.join(QGEP.wastewater_structure, QGEP.wastewater_networkelement).filter( - QGEP.wastewater_networkelement.obj_id.in_(subset_ids) - ) - for row in query: - # AVAILABLE FIELDS IN QGEP.dryweather_flume - - # --- structure_part --- - # fk_dataowner, fk_provider, fk_wastewater_structure, identifier, last_modification, remark, renovation_demand - - # --- dryweather_flume --- - # material, obj_id - - # --- _bwrel_ --- - # access_aid_kind__BWREL_obj_id, backflow_prevention__BWREL_obj_id, benching_kind__BWREL_obj_id, dryweather_flume_material__BWREL_obj_id, electric_equipment__BWREL_obj_id, electromechanical_equipment__BWREL_obj_id, solids_retention__BWREL_obj_id, tank_cleaning__BWREL_obj_id, tank_emptying__BWREL_obj_id - - # --- _rel_ --- - # fk_dataowner__REL, fk_provider__REL, fk_wastewater_structure__REL, material__REL, renovation_demand__REL - - trockenwetterrinne = ABWASSER.trockenwetterrinne( - # FIELDS TO MAP TO ABWASSER.trockenwetterrinne - # --- baseclass --- - # --- sia405_baseclass --- - **qgep_export_utils.base_common(row, "trockenwetterrinne"), - # --- bauwerksteil --- - **qgep_export_utils.structure_part_common(row), - # --- trockenwetterrinne --- - material=qgep_export_utils.get_vl(row.material__REL), - ) - abwasser_session.add(trockenwetterrinne) - qgep_export_utils.create_metaattributes(row) - print(".", end="") - logger.info("done") - abwasser_session.flush() + qgep_export_utils.export_dryweather_flume() logger.info("Exporting QGEP.cover -> ABWASSER.deckel, ABWASSER.metaattribute") - query = qgep_session.query(QGEP.cover) - if filtered: - query = query.join(QGEP.wastewater_structure, QGEP.wastewater_networkelement).filter( - QGEP.wastewater_networkelement.obj_id.in_(subset_ids) - ) - for row in query: - # AVAILABLE FIELDS IN QGEP.cover - - # --- structure_part --- - # fk_dataowner, fk_provider, fk_wastewater_structure, identifier, last_modification, remark, renovation_demand - - # --- cover --- - # brand, cover_shape, diameter, fastening, level, material, obj_id, positional_accuracy, situation_geometry, sludge_bucket, venting - - # --- _bwrel_ --- - # access_aid_kind__BWREL_obj_id, backflow_prevention__BWREL_obj_id, benching_kind__BWREL_obj_id, dryweather_flume_material__BWREL_obj_id, electric_equipment__BWREL_obj_id, electromechanical_equipment__BWREL_obj_id, solids_retention__BWREL_obj_id, tank_cleaning__BWREL_obj_id, tank_emptying__BWREL_obj_id, wastewater_structure__BWREL_fk_main_cover - - # --- _rel_ --- - # cover_shape__REL, fastening__REL, fk_dataowner__REL, fk_provider__REL, fk_wastewater_structure__REL, material__REL, positional_accuracy__REL, renovation_demand__REL, sludge_bucket__REL, venting__REL - - deckel = ABWASSER.deckel( - # FIELDS TO MAP TO ABWASSER.deckel - # --- baseclass --- - # --- sia405_baseclass --- - **qgep_export_utils.base_common(row, "deckel"), - # --- bauwerksteil --- - **qgep_export_utils.structure_part_common(row), - # --- deckel --- - deckelform=qgep_export_utils.get_vl(row.cover_shape__REL), - durchmesser=row.diameter, - entlueftung=qgep_export_utils.get_vl(row.venting__REL), - fabrikat=row.brand, - kote=row.level, - lage=ST_Force2D(row.situation_geometry), - lagegenauigkeit=qgep_export_utils.get_vl(row.positional_accuracy__REL), - material=qgep_export_utils.get_vl(row.material__REL), - schlammeimer=qgep_export_utils.get_vl(row.sludge_bucket__REL), - verschluss=qgep_export_utils.get_vl(row.fastening__REL), - ) - abwasser_session.add(deckel) - qgep_export_utils.create_metaattributes(row) - print(".", end="") - logger.info("done") - abwasser_session.flush() + qgep_export_utils.export_cover() logger.info("Exporting QGEP.benching -> ABWASSER.bankett, ABWASSER.metaattribute") - query = qgep_session.query(QGEP.benching) - if filtered: - query = query.join(QGEP.wastewater_structure, QGEP.wastewater_networkelement).filter( - QGEP.wastewater_networkelement.obj_id.in_(subset_ids) - ) - for row in query: - # AVAILABLE FIELDS IN QGEP.benching - - # --- structure_part --- - # fk_dataowner, fk_provider, fk_wastewater_structure, identifier, last_modification, remark, renovation_demand - - # --- benching --- - # kind, obj_id - - # --- _bwrel_ --- - # access_aid_kind__BWREL_obj_id, backflow_prevention__BWREL_obj_id, benching_kind__BWREL_obj_id, dryweather_flume_material__BWREL_obj_id, electric_equipment__BWREL_obj_id, electromechanical_equipment__BWREL_obj_id, solids_retention__BWREL_obj_id, tank_cleaning__BWREL_obj_id, tank_emptying__BWREL_obj_id - - # --- _rel_ --- - # fk_dataowner__REL, fk_provider__REL, fk_wastewater_structure__REL, kind__REL, renovation_demand__REL - - bankett = ABWASSER.bankett( - # FIELDS TO MAP TO ABWASSER.bankett - # --- baseclass --- - # --- sia405_baseclass --- - **qgep_export_utils.base_common(row, "bankett"), - # --- bauwerksteil --- - **qgep_export_utils.structure_part_common(row), - # --- bankett --- - art=qgep_export_utils.get_vl(row.kind__REL), - ) - abwasser_session.add(bankett) - qgep_export_utils.create_metaattributes(row) - print(".", end="") - logger.info("done") - abwasser_session.flush() + qgep_export_utils.export_benching() # Labels # Note: these are extracted from the optional labels file (not exported from the QGEP database) @@ -723,9 +264,9 @@ def qgep_export(selection=None, labels_file=None, orientation=None, basket_enabl "haltung": {}, "abwasserbauwerk": {}, } - for row in abwasser_session.query(ABWASSER.haltung): + for row in abwasser_session.query(abwasser_model.haltung): tid_for_obj_id["haltung"][row.obj_id] = row.t_id - for row in abwasser_session.query(ABWASSER.abwasserbauwerk): + for row in abwasser_session.query(abwasser_model.abwasserbauwerk): tid_for_obj_id["abwasserbauwerk"][row.obj_id] = row.t_id with open(labels_file) as labels_file_handle: @@ -751,7 +292,7 @@ def qgep_export(selection=None, labels_file=None, orientation=None, basket_enabl f"Label for haltung `{obj_id}` exists, but that object is not part of the export" ) continue - ili_label = ABWASSER.haltung_text( + ili_label = abwasser_model.haltung_text( **qgep_export_utils.textpos_common(label, "haltung_text", geojson_crs_def), haltungref=tid_for_obj_id["haltung"][obj_id], ) @@ -762,7 +303,7 @@ def qgep_export(selection=None, labels_file=None, orientation=None, basket_enabl f"Label for abwasserbauwerk `{obj_id}` exists, but that object is not part of the export" ) continue - ili_label = ABWASSER.abwasserbauwerk_text( + ili_label = abwasser_model.abwasserbauwerk_text( **qgep_export_utils.textpos_common( label, "abwasserbauwerk_text", geojson_crs_def ), diff --git a/qgepqwat2ili/qgepsia405/import_.py b/qgepqwat2ili/qgepsia405/import_.py index 6df72e47..23cd812b 100644 --- a/qgepqwat2ili/qgepsia405/import_.py +++ b/qgepqwat2ili/qgepsia405/import_.py @@ -11,7 +11,7 @@ from .model_qgep import get_qgep_model -def qgep_import(precommit_callback=None): +def qgep_import_sia405(precommit_callback=None): """ Imports data from the ili2pg model into the QGEP model. diff --git a/qgepqwat2ili/utils/qgep_export_utils.py b/qgepqwat2ili/utils/qgep_export_utils.py index 467936c5..5c0eec9a 100644 --- a/qgepqwat2ili/utils/qgep_export_utils.py +++ b/qgepqwat2ili/utils/qgep_export_utils.py @@ -1,6 +1,7 @@ import json from geoalchemy2.functions import ST_Force2D, ST_GeomFromGeoJSON +from sqlalchemy import or_ from .various import logger @@ -8,13 +9,26 @@ class QgepExportUtils: def __init__( - self, tid_maker, current_basket, abwasser_session, abwasser_model, labelorientation + self, + tid_maker, + current_basket, + abwasser_session, + abwasser_model, + qgep_session, + qgep_model, + labelorientation, + filtered, + subset_ids, ): self.tid_maker = tid_maker self.current_basket = current_basket self.abwasser_session = abwasser_session self.abwasser_model = abwasser_model + self.qgep_session = qgep_session + self.qgep_model = qgep_model self.labelorientation = labelorientation + self.filtered = filtered + self.subset_ids = subset_ids def get_tid(self, relation): """ @@ -85,7 +99,7 @@ def modulo_angle(self, val): return val - def check_fk_in_subsetid(self, subset, relation, filtered=False): + def check_fk_in_subsetid(self, subset, relation): """ checks, whether foreignkey is in the subset_ids - if yes it return the tid of the foreignkey, if no it will return None """ @@ -103,7 +117,7 @@ def check_fk_in_subsetid(self, subset, relation, filtered=False): logger.info(f"check_fk_in_subsetid - tid = '{self.tid_maker.tid_for_row(relation)}' ") return self.tid_maker.tid_for_row(relation) else: - if filtered: + if self.filtered: logger.warning( f"check_fk_in_subsetid - '{fremdschluesselstr}' is not in subset - replaced with None instead!" ) @@ -241,3 +255,498 @@ def textpos_common(self, row, t_type, geojson_crs_def): textpos["t_basket"] = self.current_basket.t_id return textpos + + def export_organisation(self): + query = self.qgep_session.query(self.qgep_model.organisation) + for row in query: + + # AVAILABLE FIELDS IN QGEP.organisation + + # --- organisation --- + # fk_dataowner, fk_provider, identifier, last_modification, obj_id, remark, uid + + # --- _bwrel_ --- + # accident__BWREL_fk_dataowner, accident__BWREL_fk_provider, administrative_office__BWREL_obj_id, aquifier__BWREL_fk_dataowner, aquifier__BWREL_fk_provider, bathing_area__BWREL_fk_dataowner, bathing_area__BWREL_fk_provider, canton__BWREL_obj_id, catchment_area__BWREL_fk_dataowner, catchment_area__BWREL_fk_provider, connection_object__BWREL_fk_dataowner, connection_object__BWREL_fk_operator, connection_object__BWREL_fk_owner, connection_object__BWREL_fk_provider, control_center__BWREL_fk_dataowner, control_center__BWREL_fk_provider, cooperative__BWREL_obj_id, damage__BWREL_fk_dataowner, damage__BWREL_fk_provider, data_media__BWREL_fk_dataowner, data_media__BWREL_fk_provider, file__BWREL_fk_dataowner, file__BWREL_fk_provider, fish_pass__BWREL_fk_dataowner, fish_pass__BWREL_fk_provider, hazard_source__BWREL_fk_dataowner, hazard_source__BWREL_fk_owner, hazard_source__BWREL_fk_provider, hq_relation__BWREL_fk_dataowner, hq_relation__BWREL_fk_provider, hydr_geom_relation__BWREL_fk_dataowner, hydr_geom_relation__BWREL_fk_provider, hydr_geometry__BWREL_fk_dataowner, hydr_geometry__BWREL_fk_provider, hydraulic_char_data__BWREL_fk_dataowner, hydraulic_char_data__BWREL_fk_provider, maintenance_event__BWREL_fk_dataowner, maintenance_event__BWREL_fk_operating_company, maintenance_event__BWREL_fk_provider, measurement_result__BWREL_fk_dataowner, measurement_result__BWREL_fk_provider, measurement_series__BWREL_fk_dataowner, measurement_series__BWREL_fk_provider, measuring_device__BWREL_fk_dataowner, measuring_device__BWREL_fk_provider, measuring_point__BWREL_fk_dataowner, measuring_point__BWREL_fk_operator, measuring_point__BWREL_fk_provider, mechanical_pretreatment__BWREL_fk_dataowner, mechanical_pretreatment__BWREL_fk_provider, municipality__BWREL_obj_id, mutation__BWREL_fk_dataowner, mutation__BWREL_fk_provider, organisation__BWREL_fk_dataowner, organisation__BWREL_fk_provider, overflow__BWREL_fk_dataowner, overflow__BWREL_fk_provider, overflow_char__BWREL_fk_dataowner, overflow_char__BWREL_fk_provider, pipe_profile__BWREL_fk_dataowner, pipe_profile__BWREL_fk_provider, private__BWREL_obj_id, profile_geometry__BWREL_fk_dataowner, profile_geometry__BWREL_fk_provider, reach_point__BWREL_fk_dataowner, reach_point__BWREL_fk_provider, retention_body__BWREL_fk_dataowner, retention_body__BWREL_fk_provider, river_bank__BWREL_fk_dataowner, river_bank__BWREL_fk_provider, river_bed__BWREL_fk_dataowner, river_bed__BWREL_fk_provider, sector_water_body__BWREL_fk_dataowner, sector_water_body__BWREL_fk_provider, sludge_treatment__BWREL_fk_dataowner, sludge_treatment__BWREL_fk_provider, structure_part__BWREL_fk_dataowner, structure_part__BWREL_fk_provider, substance__BWREL_fk_dataowner, substance__BWREL_fk_provider, surface_runoff_parameters__BWREL_fk_dataowner, surface_runoff_parameters__BWREL_fk_provider, surface_water_bodies__BWREL_fk_dataowner, surface_water_bodies__BWREL_fk_provider, throttle_shut_off_unit__BWREL_fk_dataowner, throttle_shut_off_unit__BWREL_fk_provider, txt_symbol__BWREL_fk_dataowner, txt_symbol__BWREL_fk_provider, waste_water_association__BWREL_obj_id, waste_water_treatment__BWREL_fk_dataowner, waste_water_treatment__BWREL_fk_provider, waste_water_treatment_plant__BWREL_obj_id, wastewater_networkelement__BWREL_fk_dataowner, wastewater_networkelement__BWREL_fk_provider, wastewater_structure__BWREL_fk_dataowner, wastewater_structure__BWREL_fk_operator, wastewater_structure__BWREL_fk_owner, wastewater_structure__BWREL_fk_provider, wastewater_structure_symbol__BWREL_fk_dataowner, wastewater_structure_symbol__BWREL_fk_provider, water_catchment__BWREL_fk_dataowner, water_catchment__BWREL_fk_provider, water_control_structure__BWREL_fk_dataowner, water_control_structure__BWREL_fk_provider, water_course_segment__BWREL_fk_dataowner, water_course_segment__BWREL_fk_provider, wwtp_energy_use__BWREL_fk_dataowner, wwtp_energy_use__BWREL_fk_provider, zone__BWREL_fk_dataowner, zone__BWREL_fk_provider + + # --- _rel_ --- + # fk_dataowner__REL, fk_provider__REL + + organisation = self.abwasser_model.organisation( + # FIELDS TO MAP TO ABWASSER.organisation + # --- baseclass --- + # --- sia405_baseclass --- + **self.base_common(row, "organisation"), + # --- organisation --- + auid=row.uid, + bemerkung=self.truncate(self.emptystr_to_null(row.remark), 80), + bezeichnung=self.null_to_emptystr(row.identifier), + ) + self.abwasser_session.add(organisation) + self.create_metaattributes(row) + print(".", end="") + logger.info("done") + self.abwasser_session.flush() + + def export_channel(self): + query = self.qgep_session.query(self.qgep_model.channel) + if self.filtered: + query = query.join(self.qgep_model.wastewater_networkelement).filter( + self.qgep_model.wastewater_networkelement.obj_id.in_(self.subset_ids) + ) + for row in query: + # AVAILABLE FIELDS IN QGEP.channel + + # --- wastewater_structure --- + # _bottom_label, _cover_label, _depth, _function_hierarchic, _input_label, _label, _output_label, _usage_current, accessibility, contract_section, detail_geometry_geometry, financing, fk_dataowner, fk_main_cover, fk_main_wastewater_node, fk_operator, fk_owner, fk_provider, gross_costs, identifier, inspection_interval, last_modification, location_name, records, remark, renovation_necessity, replacement_value, rv_base_year, rv_construction_type, status, structure_condition, subsidies, year_of_construction, year_of_replacement + + # --- _bwrel_ --- + # measuring_point__BWREL_fk_wastewater_structure, mechanical_pretreatment__BWREL_fk_wastewater_structure, re_maintenance_event_wastewater_structure__BWREL_fk_wastewater_structure, structure_part__BWREL_fk_wastewater_structure, txt_symbol__BWREL_fk_wastewater_structure, txt_text__BWREL_fk_wastewater_structure, wastewater_networkelement__BWREL_fk_wastewater_structure, wastewater_structure_symbol__BWREL_fk_wastewater_structure, wastewater_structure_text__BWREL_fk_wastewater_structure, wwtp_structure_kind__BWREL_obj_id + + # --- _rel_ --- + # accessibility__REL, bedding_encasement__REL, connection_type__REL, financing__REL, fk_dataowner__REL, fk_main_cover__REL, fk_main_wastewater_node__REL, fk_operator__REL, fk_owner__REL, fk_provider__REL, function_hierarchic__REL, function_hydraulic__REL, renovation_necessity__REL, rv_construction_type__REL, status__REL, structure_condition__REL, usage_current__REL, usage_planned__REL + + kanal = self.abwasser_model.kanal( + # FIELDS TO MAP TO ABWASSER.kanal + # --- baseclass --- + # --- sia405_baseclass --- + **self.base_common(row, "kanal"), + # --- abwasserbauwerk --- + **self.wastewater_structure_common(row), + # --- kanal --- + bettung_umhuellung=self.get_vl(row.bedding_encasement__REL), + funktionhierarchisch=self.get_vl(row.function_hierarchic__REL), + funktionhydraulisch=self.get_vl(row.function_hydraulic__REL), + nutzungsart_geplant=self.get_vl(row.usage_planned__REL), + nutzungsart_ist=self.get_vl(row.usage_current__REL), + rohrlaenge=row.pipe_length, + spuelintervall=row.jetting_interval, + verbindungsart=self.get_vl(row.connection_type__REL), + ) + self.abwasser_session.add(kanal) + self.create_metaattributes(row) + print(".", end="") + logger.info("done") + self.abwasser_session.flush() + + def export_manhole(self): + query = self.qgep_session.query(self.qgep_model.manhole) + if self.filtered: + query = query.join(self.qgep_model.wastewater_networkelement).filter( + self.qgep_model.wastewater_networkelement.obj_id.in_(self.subset_ids) + ) + for row in query: + # AVAILABLE FIELDS IN QGEP.manhole + + # --- wastewater_structure --- + # to do attributeslist of superclass + # --- manhole --- + # to do attributeslist of subclass + # to do extra funktion schreiben wo alle englischen attribute erzeugt werden + + # --- _bwrel_ --- + # to do extra funktion schreiben wo alle fk auf diese superklasse erzeugt werden z.B. # measuring_point__BWREL_fk_wastewater_structure, + + # --- _rel_ --- + # to do extra funktion schreiben wo alle fk auf diese klasse erzeugt werden z.B. # accessibility__REL, bedding_encasement__REL, + + normschacht = self.abwasser_model.normschacht( + # FIELDS TO MAP TO ABWASSER.normschacht + # --- baseclass --- + # --- sia405_baseclass --- + **self.base_common(row, "normschacht"), + # --- abwasserbauwerk --- + **self.wastewater_structure_common(row), + # --- normschacht --- + dimension1=row.dimension1, + dimension2=row.dimension2, + funktion=self.get_vl(row.function__REL), + # -- attribute 3D --- + # maechtigkeit=row.depth, + material=self.get_vl(row.material__REL), + oberflaechenzulauf=self.get_vl(row.surface_inflow__REL), + ) + self.abwasser_session.add(normschacht) + self.create_metaattributes(row) + print(".", end="") + logger.info("done") + self.abwasser_session.flush() + + def export_special_structure(self): + query = self.qgep_session.query(self.qgep_model.special_structure) + if self.filtered: + query = query.join(self.qgep_model.wastewater_networkelement).filter( + self.qgep_model.wastewater_networkelement.obj_id.in_(self.subset_ids) + ) + for row in query: + # AVAILABLE FIELDS IN QGEP.special_structure + + # --- wastewater_structure --- + # _bottom_label, _cover_label, _depth, _function_hierarchic, _input_label, _label, _output_label, _usage_current, accessibility, contract_section, detail_geometry_geometry, financing, fk_dataowner, fk_main_cover, fk_main_wastewater_node, fk_operator, fk_owner, fk_provider, gross_costs, identifier, inspection_interval, last_modification, location_name, records, remark, renovation_necessity, replacement_value, rv_base_year, rv_construction_type, status, structure_condition, subsidies, year_of_construction, year_of_replacement + + # --- special_structure --- + # bypass, emergency_spillway, function, obj_id, stormwater_tank_arrangement, upper_elevation + + # --- _bwrel_ --- + # measuring_point__BWREL_fk_wastewater_structure, mechanical_pretreatment__BWREL_fk_wastewater_structure, re_maintenance_event_wastewater_structure__BWREL_fk_wastewater_structure, structure_part__BWREL_fk_wastewater_structure, txt_symbol__BWREL_fk_wastewater_structure, txt_text__BWREL_fk_wastewater_structure, wastewater_networkelement__BWREL_fk_wastewater_structure, wastewater_structure_symbol__BWREL_fk_wastewater_structure, wastewater_structure_text__BWREL_fk_wastewater_structure, wwtp_structure_kind__BWREL_obj_id + + # --- _rel_ --- + # accessibility__REL, bypass__REL, emergency_spillway__REL, financing__REL, fk_dataowner__REL, fk_main_cover__REL, fk_main_wastewater_node__REL, fk_operator__REL, fk_owner__REL, fk_provider__REL, function__REL, renovation_necessity__REL, rv_construction_type__REL, status__REL, stormwater_tank_arrangement__REL, structure_condition__REL + + # QGEP field special_structure.upper_elevation is a 3D attribute and has no equivalent in the INTERLIS 2D model release used. It will be ignored for now and not supported with QGEP. + + spezialbauwerk = self.abwasser_model.spezialbauwerk( + # FIELDS TO MAP TO ABWASSER.spezialbauwerk + # --- baseclass --- + # --- sia405_baseclass --- + **self.base_common(row, "spezialbauwerk"), + # --- abwasserbauwerk --- + **self.wastewater_structure_common(row), + # --- spezialbauwerk --- + # TODO : WARNING : upper_elevation is not mapped + bypass=self.get_vl(row.bypass__REL), + funktion=self.get_vl(row.function__REL), + notueberlauf=self.get_vl(row.emergency_spillway__REL), + regenbecken_anordnung=self.get_vl(row.stormwater_tank_arrangement__REL), + ) + self.abwasser_session.add(spezialbauwerk) + self.create_metaattributes(row) + print(".", end="") + logger.info("done") + self.abwasser_session.flush() + + def export_pipe_profile(self): + query = self.qgep_session.query(self.qgep_model.pipe_profile) + if self.filtered: + query = query.join(self.qgep_model.reach).filter( + self.qgep_model.wastewater_networkelement.obj_id.in_(self.subset_ids) + ) + for row in query: + + # AVAILABLE FIELDS IN QGEP.pipe_profile + + # --- pipe_profile --- + # fk_dataowner, fk_provider, height_width_ratio, identifier, last_modification, obj_id, profile_type, remark + + # --- _bwrel_ --- + # profile_geometry__BWREL_fk_pipe_profile, reach__BWREL_fk_pipe_profile + + # --- _rel_ --- + # fk_dataowner__REL, fk_provider__REL, profile_type__REL + + rohrprofil = self.abwasser_model.rohrprofil( + # FIELDS TO MAP TO ABWASSER.rohrprofil + # --- baseclass --- + # --- sia405_baseclass --- + **self.base_common(row, "rohrprofil"), + # --- rohrprofil --- + bemerkung=self.truncate(self.emptystr_to_null(row.remark), 80), + bezeichnung=self.null_to_emptystr(row.identifier), + hoehenbreitenverhaeltnis=row.height_width_ratio, + profiltyp=self.get_vl(row.profile_type__REL), + ) + self.abwasser_session.add(rohrprofil) + self.create_metaattributes(row) + print(".", end="") + logger.info("done") + self.abwasser_session.flush() + + def export_reach_point(self): + query = self.qgep_session.query(self.qgep_model.reach_point) + if self.filtered: + query = query.join( + self.qgep_model.reach, + or_( + self.qgep_model.reach_point.obj_id + == self.qgep_model.reach.fk_reach_point_from, + self.qgep_model.reach_point.obj_id == self.qgep_model.reach.fk_reach_point_to, + ), + ).filter(self.qgep_model.wastewater_networkelement.obj_id.in_(self.subset_ids)) + for row in query: + + # AVAILABLE FIELDS IN QGEP.reach_point + + # --- reach_point --- + # elevation_accuracy, fk_dataowner, fk_provider, fk_wastewater_networkelement, identifier, last_modification, level, obj_id, outlet_shape, position_of_connection, remark, situation_geometry + + # --- _bwrel_ --- + # examination__BWREL_fk_reach_point, reach__BWREL_fk_reach_point_from, reach__BWREL_fk_reach_point_to + + # --- _rel_ --- + # elevation_accuracy__REL, fk_dataowner__REL, fk_provider__REL, fk_wastewater_networkelement__REL, outlet_shape__REL + + haltungspunkt = self.abwasser_model.haltungspunkt( + # FIELDS TO MAP TO ABWASSER.haltungspunkt + # --- baseclass --- + # --- sia405_baseclass --- + **self.base_common(row, "haltungspunkt"), + # --- haltungspunkt --- + # changed call from self.get_tid to self.check_fk_in_subsetid so it does not wirte foreignkeys on elements that do not exist + # abwassernetzelementref=self.get_tid(row.fk_wastewater_networkelement__REL), + abwassernetzelementref=self.check_fk_in_subsetid( + self.subset_ids, row.fk_wastewater_networkelement__REL + ), + auslaufform=self.get_vl(row.outlet_shape__REL), + bemerkung=self.truncate(self.emptystr_to_null(row.remark), 80), + bezeichnung=self.null_to_emptystr(row.identifier), + hoehengenauigkeit=self.get_vl(row.elevation_accuracy__REL), + kote=row.level, + lage=ST_Force2D(row.situation_geometry), + lage_anschluss=row.position_of_connection, + ) + self.abwasser_session.add(haltungspunkt) + self.create_metaattributes(row) + print(".", end="") + logger.info("done") + self.abwasser_session.flush() + + def export_reach(self): + query = self.qgep_session.query(self.qgep_model.reach) + if self.filtered: + query = query.filter( + self.qgep_model.wastewater_networkelement.obj_id.in_(self.subset_ids) + ) + for row in query: + # AVAILABLE FIELDS IN QGEP.reach + + # --- wastewater_networkelement --- + # fk_dataowner, fk_provider, fk_wastewater_structure, identifier, last_modification, remark + + # --- reach --- + # clear_height, coefficient_of_friction, elevation_determination, fk_pipe_profile, fk_reach_point_from, fk_reach_point_to, horizontal_positioning, inside_coating, length_effective, material, obj_id, progression_geometry, reliner_material, reliner_nominal_size, relining_construction, relining_kind, ring_stiffness, slope_building_plan, wall_roughness + + # --- _bwrel_ --- + # catchment_area__BWREL_fk_wastewater_networkelement_rw_current, catchment_area__BWREL_fk_wastewater_networkelement_rw_planned, catchment_area__BWREL_fk_wastewater_networkelement_ww_current, catchment_area__BWREL_fk_wastewater_networkelement_ww_planned, connection_object__BWREL_fk_wastewater_networkelement, reach_point__BWREL_fk_wastewater_networkelement, reach_text__BWREL_fk_reach, txt_text__BWREL_fk_reach + + # --- _rel_ --- + # elevation_determination__REL, fk_dataowner__REL, fk_pipe_profile__REL, fk_provider__REL, fk_reach_point_from__REL, fk_reach_point_to__REL, fk_wastewater_structure__REL, horizontal_positioning__REL, inside_coating__REL, material__REL, reliner_material__REL, relining_construction__REL, relining_kind__REL + + # QGEP field reach.elevation_determination has no equivalent in the interlis model. It will be ignored. + + haltung = self.abwasser_model.haltung( + # FIELDS TO MAP TO ABWASSER.haltung + # --- baseclass --- + # --- sia405_baseclass --- + **self.base_common(row, "haltung"), + # --- abwassernetzelement --- + **self.wastewater_networkelement_common(row), + # --- haltung --- + # NOT MAPPED : elevation_determination + innenschutz=self.get_vl(row.inside_coating__REL), + laengeeffektiv=row.length_effective, + lagebestimmung=self.get_vl(row.horizontal_positioning__REL), + lichte_hoehe=row.clear_height, + material=self.get_vl(row.material__REL), + nachhaltungspunktref=self.get_tid(row.fk_reach_point_to__REL), + plangefaelle=row.slope_building_plan, # TODO : check, does this need conversion ? + reibungsbeiwert=row.coefficient_of_friction, + reliner_art=self.get_vl(row.relining_kind__REL), + reliner_bautechnik=self.get_vl(row.relining_construction__REL), + reliner_material=self.get_vl(row.reliner_material__REL), + reliner_nennweite=row.reliner_nominal_size, + ringsteifigkeit=row.ring_stiffness, + rohrprofilref=self.get_tid(row.fk_pipe_profile__REL), + verlauf=ST_Force2D(row.progression_geometry), + # -- attribute 3D --- + # verlauf3d=row.progression3d, + vonhaltungspunktref=self.get_tid(row.fk_reach_point_from__REL), + wandrauhigkeit=row.wall_roughness, + ) + self.abwasser_session.add(haltung) + self.create_metaattributes(row) + print(".", end="") + logger.info("done") + self.abwasser_session.flush() + + def export_dryweather_downspout(self): + query = self.qgep_session.query(self.qgep_model.dryweather_downspout) + if self.filtered: + query = query.join( + self.qgep_model.wastewater_structure, self.qgep_model.wastewater_networkelement + ).filter(self.qgep_model.wastewater_networkelement.obj_id.in_(self.subset_ids)) + for row in query: + # AVAILABLE FIELDS IN QGEP.dryweather_downspout + + # --- structure_part --- + # fk_dataowner, fk_provider, fk_wastewater_structure, identifier, last_modification, remark, renovation_demand + + # --- dryweather_downspout --- + # diameter, obj_id + + # --- _bwrel_ --- + # access_aid_kind__BWREL_obj_id, backflow_prevention__BWREL_obj_id, benching_kind__BWREL_obj_id, dryweather_flume_material__BWREL_obj_id, electric_equipment__BWREL_obj_id, electromechanical_equipment__BWREL_obj_id, solids_retention__BWREL_obj_id, tank_cleaning__BWREL_obj_id, tank_emptying__BWREL_obj_id + + # --- _rel_ --- + # fk_dataowner__REL, fk_provider__REL, fk_wastewater_structure__REL, renovation_demand__REL + + trockenwetterfallrohr = self.abwasser_model.trockenwetterfallrohr( + # FIELDS TO MAP TO ABWASSER.trockenwetterfallrohr + # --- baseclass --- + # --- sia405_baseclass --- + **self.base_common(row, "trockenwetterfallrohr"), + # --- bauwerksteil --- + **self.structure_part_common(row), + # --- trockenwetterfallrohr --- + durchmesser=row.diameter, + ) + self.abwasser_session.add(trockenwetterfallrohr) + self.create_metaattributes(row) + print(".", end="") + logger.info("done") + self.abwasser_session.flush() + + def export_access_aid(self): + query = self.qgep_session.query(self.qgep_model.access_aid) + if self.filtered: + query = query.join( + self.qgep_model.wastewater_structure, self.qgep_model.wastewater_networkelement + ).filter(self.qgep_model.wastewater_networkelement.obj_id.in_(self.subset_ids)) + for row in query: + # AVAILABLE FIELDS IN QGEP.access_aid + + # --- structure_part --- + # fk_dataowner, fk_provider, fk_wastewater_structure, identifier, last_modification, remark, renovation_demand + + # --- access_aid --- + # kind, obj_id + + # --- _bwrel_ --- + # access_aid_kind__BWREL_obj_id, backflow_prevention__BWREL_obj_id, benching_kind__BWREL_obj_id, dryweather_flume_material__BWREL_obj_id, electric_equipment__BWREL_obj_id, electromechanical_equipment__BWREL_obj_id, solids_retention__BWREL_obj_id, tank_cleaning__BWREL_obj_id, tank_emptying__BWREL_obj_id + + # --- _rel_ --- + # fk_dataowner__REL, fk_provider__REL, fk_wastewater_structure__REL, kind__REL, renovation_demand__REL + + einstiegshilfe = self.abwasser_model.einstiegshilfe( + # FIELDS TO MAP TO ABWASSER.einstiegshilfe + # --- baseclass --- + # --- sia405_baseclass --- + **self.base_common(row, "einstiegshilfe"), + # --- bauwerksteil --- + **self.structure_part_common(row), + # --- einstiegshilfe --- + art=self.get_vl(row.kind__REL), + ) + self.abwasser_session.add(einstiegshilfe) + self.create_metaattributes(row) + print(".", end="") + logger.info("done") + self.abwasser_session.flush() + + def export_dryweather_flume(self): + query = self.qgep_session.query(self.qgep_model.dryweather_flume) + if self.filtered: + query = query.join( + self.qgep_model.wastewater_structure, self.qgep_model.wastewater_networkelement + ).filter(self.qgep_model.wastewater_networkelement.obj_id.in_(self.subset_ids)) + for row in query: + # AVAILABLE FIELDS IN QGEP.dryweather_flume + + # --- structure_part --- + # fk_dataowner, fk_provider, fk_wastewater_structure, identifier, last_modification, remark, renovation_demand + + # --- dryweather_flume --- + # material, obj_id + + # --- _bwrel_ --- + # access_aid_kind__BWREL_obj_id, backflow_prevention__BWREL_obj_id, benching_kind__BWREL_obj_id, dryweather_flume_material__BWREL_obj_id, electric_equipment__BWREL_obj_id, electromechanical_equipment__BWREL_obj_id, solids_retention__BWREL_obj_id, tank_cleaning__BWREL_obj_id, tank_emptying__BWREL_obj_id + + # --- _rel_ --- + # fk_dataowner__REL, fk_provider__REL, fk_wastewater_structure__REL, material__REL, renovation_demand__REL + + trockenwetterrinne = self.abwasser_model.trockenwetterrinne( + # FIELDS TO MAP TO ABWASSER.trockenwetterrinne + # --- baseclass --- + # --- sia405_baseclass --- + **self.base_common(row, "trockenwetterrinne"), + # --- bauwerksteil --- + **self.structure_part_common(row), + # --- trockenwetterrinne --- + material=self.get_vl(row.material__REL), + ) + self.abwasser_session.add(trockenwetterrinne) + self.create_metaattributes(row) + print(".", end="") + logger.info("done") + self.abwasser_session.flush() + + def export_cover(self): + query = self.qgep_session.query(self.qgep_model.cover) + if self.filtered: + query = query.join( + self.qgep_model.wastewater_structure, self.qgep_model.wastewater_networkelement + ).filter(self.qgep_model.wastewater_networkelement.obj_id.in_(self.subset_ids)) + for row in query: + # AVAILABLE FIELDS IN QGEP.cover + + # --- structure_part --- + # fk_dataowner, fk_provider, fk_wastewater_structure, identifier, last_modification, remark, renovation_demand + + # --- cover --- + # brand, cover_shape, diameter, fastening, level, material, obj_id, positional_accuracy, situation_geometry, sludge_bucket, venting + + # --- _bwrel_ --- + # access_aid_kind__BWREL_obj_id, backflow_prevention__BWREL_obj_id, benching_kind__BWREL_obj_id, dryweather_flume_material__BWREL_obj_id, electric_equipment__BWREL_obj_id, electromechanical_equipment__BWREL_obj_id, solids_retention__BWREL_obj_id, tank_cleaning__BWREL_obj_id, tank_emptying__BWREL_obj_id, wastewater_structure__BWREL_fk_main_cover + + # --- _rel_ --- + # cover_shape__REL, fastening__REL, fk_dataowner__REL, fk_provider__REL, fk_wastewater_structure__REL, material__REL, positional_accuracy__REL, renovation_demand__REL, sludge_bucket__REL, venting__REL + + deckel = self.abwasser_model.deckel( + # FIELDS TO MAP TO ABWASSER.deckel + # --- baseclass --- + # --- sia405_baseclass --- + **self.base_common(row, "deckel"), + # --- bauwerksteil --- + **self.structure_part_common(row), + # --- deckel --- + deckelform=self.get_vl(row.cover_shape__REL), + durchmesser=row.diameter, + entlueftung=self.get_vl(row.venting__REL), + fabrikat=row.brand, + kote=row.level, + lage=ST_Force2D(row.situation_geometry), + lagegenauigkeit=self.get_vl(row.positional_accuracy__REL), + material=self.get_vl(row.material__REL), + schlammeimer=self.get_vl(row.sludge_bucket__REL), + verschluss=self.get_vl(row.fastening__REL), + ) + self.abwasser_session.add(deckel) + self.create_metaattributes(row) + print(".", end="") + logger.info("done") + self.abwasser_session.flush() + + def export_benching(self): + query = self.qgep_session.query(self.qgep_model.benching) + if self.filtered: + query = query.join( + self.qgep_model.wastewater_structure, self.qgep_model.wastewater_networkelement + ).filter(self.qgep_model.wastewater_networkelement.obj_id.in_(self.subset_ids)) + for row in query: + # AVAILABLE FIELDS IN QGEP.benching + + # --- structure_part --- + # fk_dataowner, fk_provider, fk_wastewater_structure, identifier, last_modification, remark, renovation_demand + + # --- benching --- + # kind, obj_id + + # --- _bwrel_ --- + # access_aid_kind__BWREL_obj_id, backflow_prevention__BWREL_obj_id, benching_kind__BWREL_obj_id, dryweather_flume_material__BWREL_obj_id, electric_equipment__BWREL_obj_id, electromechanical_equipment__BWREL_obj_id, solids_retention__BWREL_obj_id, tank_cleaning__BWREL_obj_id, tank_emptying__BWREL_obj_id + + # --- _rel_ --- + # fk_dataowner__REL, fk_provider__REL, fk_wastewater_structure__REL, kind__REL, renovation_demand__REL + + bankett = self.abwasser_model.bankett( + # FIELDS TO MAP TO ABWASSER.bankett + # --- baseclass --- + # --- sia405_baseclass --- + **self.base_common(row, "bankett"), + # --- bauwerksteil --- + **self.structure_part_common(row), + # --- bankett --- + art=self.get_vl(row.kind__REL), + ) + self.abwasser_session.add(bankett) + self.create_metaattributes(row) + print(".", end="") + logger.info("done") + self.abwasser_session.flush()