def add_reading(self, temperature_reading, humidity_reading): Base.metadata.create_all(engine) session = Session() reading = SensorsReading(humidity_reading, temperature_reading) session.add(reading) session.commit() session.close()
def add_sensor_notification(self, notification_message): Base.metadata.create_all(engine) session = Session() notification = Notification(notification_message) session.add(notification) session.commit() session.close()
def add_detection_result_image(self, name, detection_result_id, type_id): Base.metadata.create_all(engine) session = Session() image = ImageAttachment(name, detection_result_id, type_id) session.add(image) session.commit() session.close()
def add_movement(self, movement): Base.metadata.create_all(engine) session = Session() session.add(movement) session.commit() generated_id = movement.id session.close() return generated_id
def add_movement_notification(self, notification_entity): Base.metadata.create_all(engine) session = Session() session.add(notification_entity) session.commit() generated_id = notification_entity.id session.close() return generated_id
def add_detection_result_with_image(self, detection_result): Base.metadata.create_all(engine) session = Session() session.add(detection_result) session.commit() generated_id = detection_result.id session.close() return generated_id
def complete_with_error(self, id): Base.metadata.create_all(engine) session = Session() requests = session.query(Detection).filter_by(id=id) for req in requests: req.statusId = 4 req.completionTime = datetime.datetime.now() session.commit() session.close()
def complete_request(self, request_id): Base.metadata.create_all(engine) session = Session() requests = session.query(Recognition).filter_by(id=request_id) for req in requests: req.statusId = 3 req.completionTime = datetime.datetime.now() session.commit() session.close()
def add_neural_network_file(self, neural_network_file: NeuralNetworkFile): Base.metadata.create_all(engine) session = Session() session.add(neural_network_file) session.commit() session.close()
def add_recognition_result(self, recognition_result): Base.metadata.create_all(engine) session = Session() session.add(recognition_result) session.commit() session.close()