def refresh(self) -> None:
     """Synchronizes values of all fields with the database.
     """
     query_str, params = query.get_single(BulkImportRequest, self.uid)
     res = self.client.execute(query_str, params)
     res = res[utils.camel_case(BulkImportRequest.type_name())]
     self._set_field_values(res)
Пример #2
0
    def _get_single(self, db_object_type, uid):
        """ Fetches a single object of the given type, for the given ID.

        Args:
            db_object_type (type): DbObject subclass.
            uid (str): Unique ID of the row.
        Return:
            Object of `db_object_type`.
        Raises:
            labelbox.exceptions.ResourceNotFoundError: If there is no object
                of the given type for the given ID.
        """
        query_str, params = query.get_single(db_object_type, uid)
        res = self.execute(query_str, params)
        res = res[utils.camel_case(db_object_type.type_name())]
        if res is None:
            raise labelbox.exceptions.ResourceNotFoundError(
                db_object_type, params)
        else:
            return db_object_type(self, res)