コード例 #1
0
 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()
コード例 #2
0
 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()
コード例 #3
0
 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()
コード例 #4
0
 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
コード例 #5
0
 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
コード例 #6
0
 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
コード例 #7
0
 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()
コード例 #8
0
 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()
コード例 #9
0
 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()
コード例 #10
0
 def add_recognition_result(self, recognition_result):
     Base.metadata.create_all(engine)
     session = Session()
     session.add(recognition_result)
     session.commit()
     session.close()