Data Models

AsyncCogniteClient.data_modeling.data_models.apply(...)

Create or update one or more data model.

AsyncCogniteClient.data_modeling.data_models.delete(ids)

Delete one or more data model.

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

List data models.

AsyncCogniteClient.data_modeling.data_models.retrieve(ids)

Retrieve data_model(s) by id(s).

Data model data classes

class cognite.client.data_classes.data_modeling.data_models.DataModel(
space: str,
external_id: str,
version: str,
is_global: bool,
last_updated_time: int,
created_time: int,
description: str | None,
name: str | None,
views: list[T_View] | None,
)

Bases: DataModelCore, Generic[T_View]

A group of views. This is the read version of a Data Model

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

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

  • version (str) – DMS version.

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

  • 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 data model

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

  • views (list[T_View] | None) – List of views included in this data model.

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.data_models.DataModelApply(
space: str,
external_id: str,
version: str,
description: str | None = None,
name: str | None = None,
views: Sequence[ViewId | ViewApply] | None = None,
)

Bases: DataModelCore

A group of views. This is the write version of a Data Model.

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

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

  • version (str) – DMS version.

  • description (str | None) – Textual description of the data model

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

  • views (Sequence[ViewId | ViewApply] | None) – List of views included in this data model.

as_write() DataModelApply

Returns this DataModelApply 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]

class cognite.client.data_classes.data_modeling.data_models.DataModelApplyList(
resources: Sequence[T_CogniteResource],
)

Bases: CogniteResourceList[DataModelApply]

as_ids() list[DataModelId]

Convert the list of data models to a list of data model ids.

Returns:

The list of data model ids.

Return type:

list[DataModelId]

class cognite.client.data_classes.data_modeling.data_models.DataModelCore(
space: str,
external_id: str,
version: str,
description: str | None,
name: str | None,
)

Bases: DataModelingSchemaResource[DataModelApply], ABC

A group of views.

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

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

  • version (str) – DMS version.

  • description (str | None) – Textual description of the data model

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

class cognite.client.data_classes.data_modeling.data_models.DataModelFilter(
space: str | None = None,
inline_views: bool = False,
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

  • inline_views (bool) – Whether to expand the referenced views inline in the returned result.

  • 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.data_models.DataModelList(
resources: Sequence[T_CogniteResource],
)

Bases: WriteableCogniteResourceList[DataModelApply, DataModel[T_View]]

as_apply() DataModelApplyList

Convert the list of data models to a list of data model applies.

Returns:

The list of data model applies.

Return type:

DataModelApplyList

as_ids() list[DataModelId]

Convert the list of data models to a list of data model ids.

Returns:

The list of data model ids.

Return type:

list[DataModelId]

latest_version(
key: Literal['created_time', 'last_updated_time'] = 'created_time',
) DataModel[T_View]

Get the data model in the list with the latest version. The latest version is determined based on the created_time or last_updated_time field.

Parameters:

key (Literal['created_time', 'last_updated_time']) – The field to use for determining the latest version.

Returns:

The data model with the latest version.

Return type:

DataModel[T_View]

class cognite.client.data_classes.data_modeling.data_models.DataModelsSort(
property: Literal['space', 'external_id', 'name', 'description', 'version', 'created_time', 'last_updated_time'],
direction: Literal['ascending', 'descending'] = 'ascending',
nulls_first: bool = False,
)

Bases: DataModelingSort