Skip to content

Commit

Permalink
Include actually mapping a property in the apply view example (#1513)
Browse files Browse the repository at this point in the history
  • Loading branch information
erlendvollset authored Nov 16, 2023
1 parent 3303c67 commit cc3940b
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions cognite/client/_api/data_modeling/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,10 +223,21 @@ def apply(self, view: ViewApply | Sequence[ViewApply]) -> View | ViewList:
Create new views::
>>> from cognite.client import CogniteClient
>>> from cognite.client.data_classes.data_modeling import ViewApply
>>> from cognite.client.data_classes.data_modeling import ViewApply, MappedPropertyApply, ContainerId
>>> c = CogniteClient()
>>> views = [ViewApply(space="mySpace",external_id="myView",version="v1"),
... ViewApply(space="mySpace",external_id="myOtherView",version="v1")]
>>> views = [
... ViewApply(
... space="mySpace",
... external_id="myView",
... version="v1",
... properties={
... "someAlias": MappedPropertyApply(
... container=ContainerId("mySpace", "myContainer"),
... container_property_identifier="someProperty",
... ),
... }
... )
... ]
>>> res = c.data_modeling.views.apply(views)
"""
return self._create_multiple(
Expand Down

0 comments on commit cc3940b

Please sign in to comment.