From 8ca9b23d89d4a855bd4cc6de14ab9f47ab90bebb Mon Sep 17 00:00:00 2001 From: Erlend vollset Date: Fri, 18 Oct 2024 13:53:04 +0200 Subject: [PATCH] Make views example less confusing (#1982) --- cognite/client/_api/data_modeling/views.py | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/cognite/client/_api/data_modeling/views.py b/cognite/client/_api/data_modeling/views.py index 76f537bc1..58ee367d7 100644 --- a/cognite/client/_api/data_modeling/views.py +++ b/cognite/client/_api/data_modeling/views.py @@ -263,6 +263,7 @@ def apply(self, view: ViewApply | Sequence[ViewApply]) -> View | ViewList: ... ViewId ... ) >>> client = CogniteClient() + >>> acts_in_edge_type = DirectRelationReference(space="imdb", external_id="acts-in") >>> movie_view = ViewApply( ... space="imdb", ... external_id="Movie", @@ -274,12 +275,10 @@ def apply(self, view: ViewApply | Sequence[ViewApply]) -> View | ViewList: ... container_property_identifier="title", ... ), ... "actors": MultiEdgeConnectionApply( - ... type=DirectRelationReference( - ... space="imdb", external_id="Movie.actors" - ... ), + ... type=acts_in_edge_type, + ... direction="inwards", ... source=ViewId("imdb", "Actor", "1"), ... name="actors", - ... direction="outwards", ... ), ... } ... ) @@ -295,12 +294,10 @@ def apply(self, view: ViewApply | Sequence[ViewApply]) -> View | ViewList: ... container_property_identifier="name", ... ), ... "movies": MultiEdgeConnectionApply( - ... type=DirectRelationReference( - ... space="imdb", external_id="Role.movies" - ... ), + ... type=acts_in_edge_type, + ... direction="outwards", ... source=ViewId("imdb", "Movie", "1"), ... name="movies", - ... direction="outwards", ... ), ... } ... )