def get_all_people_connected_to_neural_network(self, nn_id): result = [] Base.metadata.create_all(engine) session = Session() people = session.query(NeuralNetworkPerson).filter_by(neural_network_id=nn_id) session.close() for p in people: result.append(p.person_id) return result
def get_azure_file_connected_to_neural_network(self, nn_id): Base.metadata.create_all(engine) session = Session() result = session.query(NeuralNetworkFile).filter( NeuralNetworkFile.neuralNetworkId == nn_id, NeuralNetworkFile.neuralNetworkTypeId == self.nnTypes.azure_large_group_id).first() session.close() return result
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 get_people_ids_with_images_count(self): result = [] Base.metadata.create_all(engine) session = Session() people = session.query(Person) session.close() for p in people: result.append([p.id, len(p.images)]) return result
def get_completed_neural_networks_ids_with_downloadable_files_count(self): result = [] Base.metadata.create_all(engine) session = Session() neural_networks = session.query(NeuralNetwork).filter_by(statusId=3) session.close() for nn in neural_networks: result.append([ nn.id, len([x for x in nn.files if x.neuralNetworkTypeId < 4]) ]) return result
def get_all_not_completed(self): Base.metadata.create_all(engine) session = Session() requests = session.query(Detection).filter_by(statusId=1) session.close() return requests
def get_by_id(self, id): Base.metadata.create_all(engine) session = Session() person = session.query(Person).filter_by(id=id).first() session.close() return person
def get_all(self): Base.metadata.create_all(engine) session = Session() people = session.query(Person) session.close() return people.all()