Views

AsyncCogniteClient.data_modeling.views.apply(view)

Create or update (upsert) one or more views.

AsyncCogniteClient.data_modeling.views.delete(ids)

Delete one or more views.

AsyncCogniteClient.data_modeling.views.list([...])

List views.

AsyncCogniteClient.data_modeling.views.retrieve(ids)

Retrieve a single view by id.

View data classes

class cognite.client.data_classes.data_modeling.views.ConnectionDefinition

Bases: ViewProperty, ABC

abstract dump(camel_case: bool = True) dict[str, Any]

Dump the instance into a json serializable Python data type.

Parameters:

camel_case (bool) – Use camelCase for attribute names. Defaults to True.

Returns:

A dictionary representation of the instance.

Return type:

dict[str, Any]

class cognite.client.data_classes.data_modeling.views.ConnectionDefinitionApply

Bases: ViewPropertyApply, ABC

abstract dump(
camel_case: bool = True,
) dict[str, Any]

Dump the instance into a json serializable Python data type.

Parameters:

camel_case (bool) – Use camelCase for attribute names. Defaults to True.

Returns:

A dictionary representation of the instance.

Return type:

dict[str, Any]

class cognite.client.data_classes.data_modeling.views.EdgeConnection(
type: DirectRelationReference,
source: ViewId,
name: str | None,
description: str | None,
edge_source: ViewId | None,
direction: Literal['outwards', 'inwards'],
)

Bases: ConnectionDefinition, ABC

Describes the edge(s) that are likely to exist to aid in discovery and documentation of the view. A listed edge is not required. i.e. It does not have to exist when included in this list. A connection has a max distance of one hop.

Parameters:
  • type (DirectRelationReference) – Reference to the node pointed to by the direct relation. The reference consists of a space and an external-id.

  • source (ViewId) – The target node(s) of this connection can be read through the view specified in ‘source’.

  • name (str | None) – Readable property name.

  • description (str | None) – Description of the content and suggested use for this property.

  • edge_source (ViewId | None) – The edge(s) of this connection can be read through the view specified in ‘edgeSource’.

  • direction (Literal['outwards', 'inwards']) – The direction of the edge. The outward direction is used to indicate that the edge points from the source to the target. The inward direction is used to indicate that the edge points from the target to the source.

abstract dump(camel_case: bool = True) dict[str, Any]

Dump the instance into a json serializable Python data type.

Parameters:

camel_case (bool) – Use camelCase for attribute names. Defaults to True.

Returns:

A dictionary representation of the instance.

Return type:

dict[str, Any]

class cognite.client.data_classes.data_modeling.views.EdgeConnectionApply(
type: DirectRelationReference,
source: ViewId,
name: str | None = None,
description: str | None = None,
edge_source: ViewId | None = None,
direction: Literal['outwards', 'inwards'] = 'outwards',
)

Bases: ConnectionDefinitionApply, ABC

Describes the edge(s) that are likely to exist to aid in discovery and documentation of the view. A listed edge is not required. i.e. It does not have to exist when included in this list. A connection has a max distance of one hop.

It is called ‘EdgeConnection’ in the API spec.

Parameters:
  • type (DirectRelationReference) – Reference to the node pointed to by the direct relation. The reference consists of a space and an external-id.

  • source (ViewId) – The target node(s) of this connection can be read through the view specified in ‘source’.

  • name (str | None) – Readable property name.

  • description (str | None) – Description of the content and suggested use for this property.

  • edge_source (ViewId | None) – The edge(s) of this connection can be read through the view specified in ‘edgeSource’.

  • direction (Literal['outwards', 'inwards']) – The direction of the edge. The outward direction is used to indicate that the edge points from the source to the target. The inward direction is used to indicate that the edge points from the target to the source.

abstract dump(camel_case: bool = True) dict

Dump the instance into a json serializable Python data type.

Parameters:

camel_case (bool) – Use camelCase for attribute names. Defaults to True.

Returns:

A dictionary representation of the instance.

Return type:

dict[str, Any]

class cognite.client.data_classes.data_modeling.views.MappedProperty(
container: 'ContainerId',
container_property_identifier: 'str',
type: 'PropertyType',
nullable: 'bool',
immutable: 'bool',
auto_increment: 'bool',
source: 'ViewId | None' = None,
default_value: 'str | int | dict | None' = None,
name: 'str | None' = None,
description: 'str | None' = None,
)

Bases: ViewProperty

dump(camel_case: bool = True) dict[str, Any]

Dump the instance into a json serializable Python data type.

Parameters:

camel_case (bool) – Use camelCase for attribute names. Defaults to True.

Returns:

A dictionary representation of the instance.

Return type:

dict[str, Any]

class cognite.client.data_classes.data_modeling.views.MappedPropertyApply(
container: 'ContainerId',
container_property_identifier: 'str',
name: 'str | None' = None,
description: 'str | None' = None,
source: 'ViewId | None' = None,
)

Bases: ViewPropertyApply

dump(camel_case: bool = True) dict[str, Any]

Dump the instance into a json serializable Python data type.

Parameters:

camel_case (bool) – Use camelCase for attribute names. Defaults to True.

Returns:

A dictionary representation of the instance.

Return type:

dict[str, Any]

class cognite.client.data_classes.data_modeling.views.MultiEdgeConnection(
type: 'DirectRelationReference',
source: 'ViewId',
name: 'str | None',
description: 'str | None',
edge_source: 'ViewId | None',
direction: "Literal['outwards', 'inwards']",
)

Bases: EdgeConnection

dump(camel_case: bool = True) dict[str, Any]

Dump the instance into a json serializable Python data type.

Parameters:

camel_case (bool) – Use camelCase for attribute names. Defaults to True.

Returns:

A dictionary representation of the instance.

Return type:

dict[str, Any]

class cognite.client.data_classes.data_modeling.views.MultiEdgeConnectionApply(
type: 'DirectRelationReference',
source: 'ViewId',
name: 'str | None' = None,
description: 'str | None' = None,
edge_source: 'ViewId | None' = None,
direction: "Literal['outwards', 'inwards']" = 'outwards',
)

Bases: EdgeConnectionApply

dump(camel_case: bool = True) dict[str, Any]

Dump the instance into a json serializable Python data type.

Parameters:

camel_case (bool) – Use camelCase for attribute names. Defaults to True.

Returns:

A dictionary representation of the instance.

Return type:

dict[str, Any]

class cognite.client.data_classes.data_modeling.views.MultiReverseDirectRelation(
source: 'ViewId',
through: 'PropertyId',
name: 'str | None' = None,
description: 'str | None' = None,
)

Bases: ReverseDirectRelation

dump(
camel_case: bool = True,
) dict[str, Any]

Dump the instance into a json serializable Python data type.

Parameters:

camel_case (bool) – Use camelCase for attribute names. Defaults to True.

Returns:

A dictionary representation of the instance.

Return type:

dict[str, Any]

class cognite.client.data_classes.data_modeling.views.MultiReverseDirectRelationApply(
source: 'ViewId',
through: 'PropertyId',
name: 'str | None' = None,
description: 'str | None' = None,
)

Bases: ReverseDirectRelationApply

dump(
camel_case: bool = True,
) dict[str, Any]

Dump the instance into a json serializable Python data type.

Parameters:

camel_case (bool) – Use camelCase for attribute names. Defaults to True.

Returns:

A dictionary representation of the instance.

Return type:

dict[str, Any]

class cognite.client.data_classes.data_modeling.views.ReverseDirectRelation(
source: ViewId,
through: PropertyId,
name: str | None = None,
description: str | None = None,
)

Bases: ConnectionDefinition, ABC

Describes the direct relation(s) pointing to instances read through this view. This connection type is used to aid in discovery and documentation of the view

It is called ‘ReverseDirectRelationConnection’ in the API spec.

Parameters:
  • source (ViewId) – The node(s) containing the direct relation property can be read through the view specified in ‘source’.

  • through (PropertyId) – The view or container of the node containing the direct relation property.

  • name (str | None) – Readable property name.

  • description (str | None) – Description of the content and suggested use for this property.

abstract dump(camel_case: bool = True) dict[str, Any]

Dump the instance into a json serializable Python data type.

Parameters:

camel_case (bool) – Use camelCase for attribute names. Defaults to True.

Returns:

A dictionary representation of the instance.

Return type:

dict[str, Any]

class cognite.client.data_classes.data_modeling.views.ReverseDirectRelationApply(
source: ViewId,
through: PropertyId,
name: str | None = None,
description: str | None = None,
)

Bases: ConnectionDefinitionApply, ABC

Describes the direct relation(s) pointing to instances read through this view. This connection type is used to aid in discovery and documentation of the view.

It is called ‘ReverseDirectRelationConnection’ in the API spec.

Parameters:
  • source (ViewId) – The node(s) containing the direct relation property can be read through the view specified in ‘source’.

  • through (PropertyId) – The view or container of the node containing the direct relation property.

  • name (str | None) – Readable property name.

  • description (str | None) – Description of the content and suggested use for this property.

abstract dump(
camel_case: bool = True,
) dict[str, Any]

Dump the instance into a json serializable Python data type.

Parameters:

camel_case (bool) – Use camelCase for attribute names. Defaults to True.

Returns:

A dictionary representation of the instance.

Return type:

dict[str, Any]

class cognite.client.data_classes.data_modeling.views.SingleEdgeConnection(
type: 'DirectRelationReference',
source: 'ViewId',
name: 'str | None',
description: 'str | None',
edge_source: 'ViewId | None',
direction: "Literal['outwards', 'inwards']",
)

Bases: EdgeConnection

dump(camel_case: bool = True) dict[str, Any]

Dump the instance into a json serializable Python data type.

Parameters:

camel_case (bool) – Use camelCase for attribute names. Defaults to True.

Returns:

A dictionary representation of the instance.

Return type:

dict[str, Any]

class cognite.client.data_classes.data_modeling.views.SingleEdgeConnectionApply(
type: 'DirectRelationReference',
source: 'ViewId',
name: 'str | None' = None,
description: 'str | None' = None,
edge_source: 'ViewId | None' = None,
direction: "Literal['outwards', 'inwards']" = 'outwards',
)

Bases: EdgeConnectionApply

dump(
camel_case: bool = True,
) dict[str, Any]

Dump the instance into a json serializable Python data type.

Parameters:

camel_case (bool) – Use camelCase for attribute names. Defaults to True.

Returns:

A dictionary representation of the instance.

Return type:

dict[str, Any]

cognite.client.data_classes.data_modeling.views.SingleHopConnectionDefinition

alias of MultiEdgeConnection

cognite.client.data_classes.data_modeling.views.SingleHopConnectionDefinitionApply

alias of MultiEdgeConnectionApply

class cognite.client.data_classes.data_modeling.views.SingleReverseDirectRelation(
source: 'ViewId',
through: 'PropertyId',
name: 'str | None' = None,
description: 'str | None' = None,
)

Bases: ReverseDirectRelation

dump(
camel_case: bool = True,
) dict[str, Any]

Dump the instance into a json serializable Python data type.

Parameters:

camel_case (bool) – Use camelCase for attribute names. Defaults to True.

Returns:

A dictionary representation of the instance.

Return type:

dict[str, Any]

class cognite.client.data_classes.data_modeling.views.SingleReverseDirectRelationApply(
source: 'ViewId',
through: 'PropertyId',
name: 'str | None' = None,
description: 'str | None' = None,
)

Bases: ReverseDirectRelationApply

dump(
camel_case: bool = True,
) dict[str, Any]

Dump the instance into a json serializable Python data type.

Parameters:

camel_case (bool) – Use camelCase for attribute names. Defaults to True.

Returns:

A dictionary representation of the instance.

Return type:

dict[str, Any]

class cognite.client.data_classes.data_modeling.views.View(
space: str,
external_id: str,
version: str,
properties: dict[str, ViewProperty],
last_updated_time: int,
created_time: int,
description: str | None,
name: str | None,
filter: Filter | None,
implements: list[ViewId] | None,
writable: bool,
used_for: Literal['node', 'edge', 'all'],
is_global: bool,
)

Bases: ViewCore

A group of properties. Read only version.

Parameters:
  • space (str) – The workspace for the view, a unique identifier for the space.

  • external_id (str) – Combined with the space is the unique identifier of the view.

  • version (str) – DMS version.

  • properties (dict[str, ViewProperty]) – View with included properties and expected edges, indexed by a unique space-local identifier.

  • last_updated_time (int) – The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds.

  • created_time (int) – The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds.

  • description (str | None) – Textual description of the view

  • name (str | None) – Human readable name for the view.

  • filter (Filter | None) – A filter Domain Specific Language (DSL) used to create advanced filter queries.

  • implements (list[ViewId] | None) – References to the views from where this view will inherit properties and edges.

  • writable (bool) – Whether the view supports write operations.

  • used_for (Literal['node', 'edge', 'all']) – Does this view apply to nodes, edges or both.

  • is_global (bool) – Whether this is a global view.

as_apply() ViewApply

Convert to a view applies.

Returns:

The view apply.

Return type:

ViewApply

dump(camel_case: bool = True) dict[str, Any]

Dump the instance into a json serializable Python data type.

Parameters:

camel_case (bool) – Use camelCase for attribute names. Defaults to True.

Returns:

A dictionary representation of the instance.

Return type:

dict[str, Any]

referenced_containers() set[ContainerId]

Helper function to get the set of containers referenced by this view.

Returns:

The set of containers referenced by this view.

Return type:

set[ContainerId]

class cognite.client.data_classes.data_modeling.views.ViewApply(
space: str,
external_id: str,
version: str,
description: str | None = None,
name: str | None = None,
filter: Filter | None = None,
implements: list[ViewId] | None = None,
properties: dict[str, ViewPropertyApply] | None = None,
)

Bases: ViewCore

A group of properties. Write only version.

Parameters:
  • space (str) – The workspace for the view, a unique identifier for the space.

  • external_id (str) – Combined with the space is the unique identifier of the view.

  • version (str) – DMS version.

  • description (str | None) – Textual description of the view

  • name (str | None) – Human readable name for the view.

  • filter (Filter | None) – A filter Domain Specific Language (DSL) used to create advanced filter queries.

  • implements (list[ViewId] | None) – References to the views from where this view will inherit properties and edges.

  • properties (dict[str, ViewPropertyApply] | None) – No description.

Note

The order of elements (i.e., ViewId) in implements matters, as it indicates priority on how to handle collisions of same properties from different views. See docs on implemented property conflicts for more details.

as_write() ViewApply

Returns this ViewApply instance.

dump(camel_case: bool = True) dict[str, Any]

Dump the instance into a json serializable Python data type.

Parameters:

camel_case (bool) – Use camelCase for attribute names. Defaults to True.

Returns:

A dictionary representation of the instance.

Return type:

dict[str, Any]

referenced_containers() set[ContainerId]

Helper function to get the set of containers referenced by this view.

Returns:

The set of containers referenced by this view.

Return type:

set[ContainerId]

class cognite.client.data_classes.data_modeling.views.ViewApplyList(
resources: Sequence[T_CogniteResource],
)

Bases: CogniteResourceList[ViewApply]

as_ids() list[ViewId]

Returns the list of ViewIds

Returns:

The list of ViewIds

Return type:

list[ViewId]

referenced_containers() set[ContainerId]

Helper function to get the set of containers referenced by this view.

Returns:

The set of containers referenced by this view.

Return type:

set[ContainerId]

class cognite.client.data_classes.data_modeling.views.ViewCore(
space: str,
external_id: str,
version: str,
description: str | None,
name: str | None,
filter: Filter | None,
implements: list[ViewId] | None,
)

Bases: DataModelingSchemaResource[ViewApply], ABC

dump(camel_case: bool = True) dict[str, Any]

Dump the instance into a json serializable Python data type.

Parameters:

camel_case (bool) – Use camelCase for attribute names. Defaults to True.

Returns:

A dictionary representation of the instance.

Return type:

dict[str, Any]

class cognite.client.data_classes.data_modeling.views.ViewFilter(
space: str | None = None,
include_inherited_properties: bool = True,
all_versions: bool = False,
include_global: bool = False,
)

Bases: CogniteFilter

Represent the filer arguments for the list endpoint.

Parameters:
  • space (str | None) – The space to query

  • include_inherited_properties (bool) – Whether to include properties inherited from views this view implements.

  • all_versions (bool) – Whether to return all versions. If false, only the newest version is returned, which is determined based on the ‘createdTime’ field.

  • include_global (bool) – Whether to include global views.

class cognite.client.data_classes.data_modeling.views.ViewList(
resources: Sequence[T_CogniteResource],
)

Bases: WriteableCogniteResourceList[ViewApply, View]

as_apply() ViewApplyList

Convert to a view an apply list.

Returns:

The view apply list.

Return type:

ViewApplyList

as_ids() list[ViewId]

Returns the list of ViewIds

Returns:

The list of ViewIds

Return type:

list[ViewId]

referenced_containers() set[ContainerId]

Helper function to get the set of containers referenced by this view.

Returns:

The set of containers referenced by this view.

Return type:

set[ContainerId]

class cognite.client.data_classes.data_modeling.views.ViewProperty

Bases: CogniteResource, ABC

abstract dump(camel_case: bool = True) dict[str, Any]

Dump the instance into a json serializable Python data type.

Parameters:

camel_case (bool) – Use camelCase for attribute names. Defaults to True.

Returns:

A dictionary representation of the instance.

Return type:

dict[str, Any]

class cognite.client.data_classes.data_modeling.views.ViewPropertyApply

Bases: CogniteResource, ABC

abstract dump(camel_case: bool = True) dict[str, Any]

Dump the instance into a json serializable Python data type.

Parameters:

camel_case (bool) – Use camelCase for attribute names. Defaults to True.

Returns:

A dictionary representation of the instance.

Return type:

dict[str, Any]