Skip to content

Commit

Permalink
docs: ref appendix in upsert methods
Browse files Browse the repository at this point in the history
  • Loading branch information
doctrino committed Jul 19, 2023
1 parent e7fe155 commit 0ca71d1
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 12 deletions.
13 changes: 1 addition & 12 deletions cognite/client/_api/assets.py
Original file line number Diff line number Diff line change
Expand Up @@ -684,18 +684,7 @@ def upsert(self, item: Asset | Sequence[Asset], mode: Literal["patch", "replace"
Note this is a convenience method that handles the upserting for you by first calling update on all items,
and if any of them fail because they do not exist, it will create them instead.
Warning:
This is not an atomic operation. It performs multiple calls to the update and create endpoints, depending
on whether the assets exist from before or not. This means that if one of the calls fail, it is possible
that some of the assets have been updated/created while others have not been created/updated.
Note:
The mode parameter controls how the update is performed. If you set 'patch', the call will only update
the fields in the Asset object that are not None. This means that if the asset exists from before, the
fields that are not specified will not be changed. If you set 'replace', all the fields that are not
specified, i.e., set to None and support being set to null, will be nulled out. See the API
documentation for the update endpoint for more information.
For more details, see :ref:`appendix-upsert`.
Args:
item (Asset | Sequence[Asset]): Asset or list of assets to upsert.
Expand Down
2 changes: 2 additions & 0 deletions cognite/client/_api/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,8 @@ def upsert(self, item: Event | Sequence[Event], mode: Literal["patch", "replace"
Note this is a convenience method that handles the upserting for you by first calling update on all items,
and if any of them fail because they do not exist, it will create them instead.
For more details, see :ref:`appendix-upsert`.
Args:
item (Event | Sequence[Event]): Event or list of events to upsert.
mode (Literal["patch", "replace"])): Whether to patch or replace in the case the events are existing. If
Expand Down
2 changes: 2 additions & 0 deletions cognite/client/_api/relationships.py
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,8 @@ def upsert(
Note this is a convenience method that handles the upserting for you by first calling update on all items,
and if any of them fail because they do not exist, it will create them instead.
For more details, see :ref:`appendix-upsert`.
Args:
item (Relationship | Sequence[Relationship]): Relationship or list of relationships to upsert.
mode (Literal["patch", "replace"])): Whether to patch or replace in the case the relationships are existing. If
Expand Down
2 changes: 2 additions & 0 deletions cognite/client/_api/sequences.py
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,8 @@ def upsert(
Note this is a convenience method that handles the upserting for you by first calling update on all items,
and if any of them fail because they do not exist, it will create them instead.
For more details, see :ref:`appendix-upsert`.
Args:
item (Sequence | Sequence[Sequence]): Sequence or list of sequences to upsert.
mode (Literal["patch", "replace"])): Whether to patch or replace in the case the sequences are existing. If
Expand Down
2 changes: 2 additions & 0 deletions cognite/client/_api/time_series.py
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,8 @@ def upsert(
Note this is a convenience method that handles the upserting for you by first calling update on all items,
and if any of them fail because they do not exist, it will create them instead.
For more details, see :ref:`appendix-upsert`.
Args:
item (TimeSeries | Sequence[TimeSeries]): TimeSeries or list of TimeSeries to upsert.
mode (Literal["patch", "replace"])): Whether to patch or replace in the case the time series are existing. If
Expand Down

0 comments on commit 0ca71d1

Please sign in to comment.