IF v_patch_port.switch_port_id IS NOT NULL THEN SELECT h.room_id INTO v_switch_port_switch_host_room_id FROM patch_port pp JOIN switch_port sp ON pp.switch_port_id = sp.id JOIN host h ON sp.switch_id = h.id WHERE pp.id = v_patch_port.id; IF v_switch_port_switch_host_room_id <> v_patch_port.switch_room_id THEN RAISE EXCEPTION 'A patch-port can only be patched to a switch that is located in the switch-room of the patch-port'; END IF; END IF; RETURN NULL; END; """, volatility='stable', strict=True, language='plpgsql')) manager.add_constraint_trigger( PatchPort.__table__, ddl.ConstraintTrigger( 'patch_port_switch_in_switch_room_trigger', PatchPort.__table__, ('INSERT', 'UPDATE'), 'patch_port_switch_in_switch_room()', deferrable=True, initially_deferred=True, )) manager.register()
s.transaction_id USING ERRCODE = 'integrity_constraint_violation'; END IF; RETURN NULL; END; """, volatility='stable', strict=True, language='plpgsql')) manager.add_constraint_trigger( Split.__table__, ddl.ConstraintTrigger( 'split_check_transaction_balanced_trigger', Split.__table__, ('INSERT', 'UPDATE', 'DELETE'), 'split_check_transaction_balanced()', deferrable=True, initially_deferred=True, )) class IllegalTransactionError(Exception): """Indicates an attempt to persist an illegal Transaction.""" pass # noinspection PyUnusedLocal @event.listens_for(Transaction, "before_insert") @event.listens_for(Transaction, "before_update") def check_transaction_on_save(mapper, connection, target): """
USING ERRCODE = 'integrity_constraint_violation'; END IF; RETURN NULL; END; """, volatility='stable', strict=True, language='plpgsql')) manager.add_constraint_trigger( RoomHistoryEntry.__table__, ddl.ConstraintTrigger( 'room_history_entry_uniqueness_trigger', RoomHistoryEntry.__table__, ('UPDATE', 'INSERT'), 'room_history_entry_uniqueness()', deferrable=True, initially_deferred=True, )) class PreMember(ModelBase, BaseUser): login = Column(String(40), nullable=False, unique=False) move_in_date = Column(Date, nullable=True) previous_dorm = Column(String, nullable=True) birthdate = Column(Date, nullable=False) passwd_hash = Column(String, nullable=False) room = relationship("Room") def __init__(self, **kwargs):