Skip to content

Commit

Permalink
Add more examples for time series with instance_id
Browse files Browse the repository at this point in the history
  • Loading branch information
sighol committed Sep 30, 2024
1 parent 970fedb commit e5e4cb6
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cognite/client/_api/datapoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,7 @@ def retrieve(
>>> client = CogniteClient()
>>> dps = client.time_series.data.retrieve(id=42, start="2w-ago")
>>> # You can also use instance_id:
>>> from cognite.client.data_classes.data_modeling.ids import NodeId
>>> from cognite.client.data_classes.data_modeling import NodeId
>>> dps = client.time_series.data.retrieve(instance_id=NodeId("ts-space", "foo"))
Although raw datapoints are returned by default, you can also get aggregated values, such as `max` or `average`. You may also fetch more than one time series simultaneously. Here we are
Expand Down
14 changes: 14 additions & 0 deletions cognite/client/_api/time_series.py
Original file line number Diff line number Diff line change
Expand Up @@ -631,6 +631,20 @@ def update(
>>> client = CogniteClient()
>>> my_update = TimeSeriesUpdate(id=1).description.set("New description").metadata.add({"key": "value"})
>>> res = client.time_series.update(my_update)
Perform a partial update on a time series by instance id::
>>> from cognite.client import CogniteClient
>>> from cognite.client.data_classes import TimeSeriesUpdate
>>> from cognite.client.data_classes.data_modeling import NodeId
>>> client = CogniteClient()
>>> my_update = (
... TimeSeriesUpdate(instance_id=NodeId("test", "hello"))
... .external_id.set("test:hello")
... .metadata.add({"test": "hello"})
... )
>>> client.time_series.update(my_update)
"""
return self._update_multiple(
list_cls=TimeSeriesList,
Expand Down

0 comments on commit e5e4cb6

Please sign in to comment.