Update datapoint subscription
- async AsyncCogniteClient.time_series.subscriptions.update(
- update: DataPointSubscriptionUpdate | DataPointSubscriptionWrite,
- mode: Literal['replace_ignore_null', 'patch', 'replace'] = 'replace_ignore_null',
-
Update a subscription. Note that Fields that are not included in the request are not changed. Furthermore, the subscription partition cannot be changed.
- Parameters:
update (DataPointSubscriptionUpdate | DataPointSubscriptionWrite) – The subscription update.
mode (Literal['replace_ignore_null', 'patch', 'replace']) – How to update data when a non-update object is given (DataPointSubscriptionWrite). 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.
- Returns:
Updated subscription.
- Return type:
Examples
Change the name of a preexisting subscription:
>>> from cognite.client import CogniteClient >>> from cognite.client.data_classes import DataPointSubscriptionUpdate >>> client = CogniteClient() >>> # async_client = AsyncCogniteClient() # another option >>> update = DataPointSubscriptionUpdate("my_subscription").name.set("My New Name") >>> updated = client.time_series.subscriptions.update(update)
Add a time series to a preexisting subscription:
>>> from cognite.client.data_classes import DataPointSubscriptionUpdate >>> update = DataPointSubscriptionUpdate("my_subscription").time_series_ids.add( ... ["MyNewTimeSeriesExternalId"] ... ) >>> updated = client.time_series.subscriptions.update(update)