Loading src/context/service/database/ConfigRule.py +14 −3 Original line number Diff line number Diff line Loading @@ -14,6 +14,7 @@ import datetime, json, logging from sqlalchemy import delete from sqlalchemy.dialects import postgresql from sqlalchemy.dialects.postgresql import insert from sqlalchemy.orm import Session from typing import Dict, List, Optional, Set Loading Loading @@ -104,8 +105,11 @@ def upsert_config_rules( str_config_rule = json.dumps(config_rule) raise Exception(MSG.format(str_config_rule, str(device_uuid), str(service_uuid), str(slice_uuid))) #LOGGER.warning('uuids_to_delete={:s}'.format(str(uuids_to_delete))) #LOGGER.warning('rules_to_upsert={:s}'.format(str(rules_to_upsert))) LOGGER.warning('device_uuid={:s}'.format(str(device_uuid))) LOGGER.warning('service_uuid={:s}'.format(str(service_uuid))) LOGGER.warning('slice_uuid={:s}'.format(str(slice_uuid))) LOGGER.warning('uuids_to_delete={:s}'.format(str(uuids_to_delete))) LOGGER.warning('rules_to_upsert={:s}'.format(str(rules_to_upsert))) delete_affected = False upsert_affected = False Loading @@ -116,7 +120,14 @@ def upsert_config_rules( if service_uuid is not None: stmt = stmt.where(ConfigRuleModel.service_uuid == service_uuid) if slice_uuid is not None: stmt = stmt.where(ConfigRuleModel.slice_uuid == slice_uuid ) stmt = stmt.where(ConfigRuleModel.configrule_uuid.in_(uuids_to_delete)) configrule_deletes = session.execute(stmt)#.fetchall() str_stmt = stmt.compile(dialect=postgresql.dialect(), compile_kwargs={"literal_binds": True}) LOGGER.warning('raw delete stmt={:s}'.format(str(str_stmt))) configrule_deletes = session.execute(stmt) LOGGER.warning('configrule_deletes.rowcount={:s}'.format(str(configrule_deletes.rowcount))) delete_affected = int(configrule_deletes.rowcount) > 0 if len(rules_to_upsert) > 0: Loading Loading
src/context/service/database/ConfigRule.py +14 −3 Original line number Diff line number Diff line Loading @@ -14,6 +14,7 @@ import datetime, json, logging from sqlalchemy import delete from sqlalchemy.dialects import postgresql from sqlalchemy.dialects.postgresql import insert from sqlalchemy.orm import Session from typing import Dict, List, Optional, Set Loading Loading @@ -104,8 +105,11 @@ def upsert_config_rules( str_config_rule = json.dumps(config_rule) raise Exception(MSG.format(str_config_rule, str(device_uuid), str(service_uuid), str(slice_uuid))) #LOGGER.warning('uuids_to_delete={:s}'.format(str(uuids_to_delete))) #LOGGER.warning('rules_to_upsert={:s}'.format(str(rules_to_upsert))) LOGGER.warning('device_uuid={:s}'.format(str(device_uuid))) LOGGER.warning('service_uuid={:s}'.format(str(service_uuid))) LOGGER.warning('slice_uuid={:s}'.format(str(slice_uuid))) LOGGER.warning('uuids_to_delete={:s}'.format(str(uuids_to_delete))) LOGGER.warning('rules_to_upsert={:s}'.format(str(rules_to_upsert))) delete_affected = False upsert_affected = False Loading @@ -116,7 +120,14 @@ def upsert_config_rules( if service_uuid is not None: stmt = stmt.where(ConfigRuleModel.service_uuid == service_uuid) if slice_uuid is not None: stmt = stmt.where(ConfigRuleModel.slice_uuid == slice_uuid ) stmt = stmt.where(ConfigRuleModel.configrule_uuid.in_(uuids_to_delete)) configrule_deletes = session.execute(stmt)#.fetchall() str_stmt = stmt.compile(dialect=postgresql.dialect(), compile_kwargs={"literal_binds": True}) LOGGER.warning('raw delete stmt={:s}'.format(str(str_stmt))) configrule_deletes = session.execute(stmt) LOGGER.warning('configrule_deletes.rowcount={:s}'.format(str(configrule_deletes.rowcount))) delete_affected = int(configrule_deletes.rowcount) > 0 if len(rules_to_upsert) > 0: Loading