def record_alarm_change(self, alarm_change): """Record alarm change event. """ session = sqlalchemy_session.get_session() with session.begin(): session.merge(User(id=alarm_change['user_id'])) session.merge(Project(id=alarm_change['project_id'])) session.merge(Project(id=alarm_change['on_behalf_of'])) alarm_change_row = AlarmChange(event_id=alarm_change['event_id']) alarm_change_row.update(alarm_change) session.add(alarm_change_row) session.flush()
def record_alarm_change(self, alarm_change): """Record alarm change event. """ session = sqlalchemy_session.get_session() with session.begin(): Connection._create_or_update(session, User, alarm_change['user_id']) Connection._create_or_update(session, Project, alarm_change['project_id']) Connection._create_or_update(session, Project, alarm_change['on_behalf_of']) alarm_change_row = AlarmChange(event_id=alarm_change['event_id']) alarm_change_row.update(alarm_change) session.add(alarm_change_row) session.flush()