Esempio n. 1
0
 def CreateDataset(self, request, context):
     # validate request payload
     data = dataset_serializer.load(request)
     dataset = documents.Dataset(name=data['name'],
                                 description=data['description'],
                                 scope=data['scope'],
                                 project=data['project']).save()
     return dataset_serializer.dump(dataset)
Esempio n. 2
0
    def UpdateDataset(self, request, context):
        # validate request payload
        data = dataset_serializer.load(request)
        # validate id
        if not data.get('id'):
            raise InvalidArgument("Dataset's id not provided.")

        # retrieve dataset
        dataset = documents.Dataset.objects(deleted=False).get(id=data['id'])

        # update name and description.
        # other fields are immutable
        dataset.name = data['name']
        dataset.description = data['description']
        dataset.last_update = datetime.datetime.now()
        dataset.save()

        return dataset_serializer.dump(dataset)
Esempio n. 3
0
    def RetrieveDataset(self, request, context):
        data = id_serializer.load(request)
        dataset = documents.Dataset.objects(deleted=False).get(id=data['id'])

        return dataset_serializer.dump(dataset)