Update data sets
- async AsyncCogniteClient.data_sets.update(
- item: DataSet | DataSetWrite | DataSetUpdate | Sequence[DataSet | DataSetWrite | DataSetUpdate],
- mode: Literal['replace_ignore_null', 'patch', 'replace'] = 'replace_ignore_null',
-
- Parameters:
item (DataSet | DataSetWrite | DataSetUpdate | Sequence[DataSet | DataSetWrite | DataSetUpdate]) – Data set(s) to update
mode (Literal['replace_ignore_null', 'patch', 'replace']) – How to update data when a non-update object is given (DataSet or -Write). If you use ‘replace_ignore_null’, only the fields you have set will be used to replace existing (default). Using ‘replace’ will additionally clear all the fields that are not specified by you. Last option, ‘patch’, will update only the fields you have set and for container-like fields such as metadata or labels, add the values to the existing. For more details, see Update and Upsert Mode Parameter.
- Returns:
Updated data set(s)
- Return type:
Examples
Update a data set that you have fetched. This will perform a full update of the data set:
>>> from cognite.client import CogniteClient, AsyncCogniteClient >>> client = CogniteClient() >>> # async_client = AsyncCogniteClient() # another option >>> data_set = client.data_sets.retrieve(id=1) >>> data_set.description = "New description" >>> res = client.data_sets.update(data_set)
Perform a partial update on a data set, updating the description and removing a field from metadata:
>>> from cognite.client.data_classes import DataSetUpdate >>> my_update = ( ... DataSetUpdate(id=1).description.set("New description").metadata.remove(["key"]) ... ) >>> res = client.data_sets.update(my_update)