Events (legacy)

AsyncCogniteClient.events.aggregate_cardinality_properties(path)

Find approximate paths count for events.

AsyncCogniteClient.events.aggregate_cardinality_values(...)

Find approximate property count for events.

AsyncCogniteClient.events.aggregate_count([...])

Count of event matching the specified filters.

AsyncCogniteClient.events.aggregate_unique_properties(path)

Get unique paths with counts for events.

AsyncCogniteClient.events.aggregate_unique_values([...])

Get unique properties with counts for events.

AsyncCogniteClient.events.create(event)

Create one or more events.

AsyncCogniteClient.events.delete([id, ...])

Delete one or more events.

AsyncCogniteClient.events.list([start_time, ...])

List events.

AsyncCogniteClient.events.retrieve([id, ...])

Retrieve a single event by id.

AsyncCogniteClient.events.retrieve_multiple([...])

Retrieve multiple events by id.

AsyncCogniteClient.events.search([...])

Search for events.

AsyncCogniteClient.events.update(item[, mode])

Update one or more events.

AsyncCogniteClient.events.upsert(item[, mode])

Upsert events, i.e., update if it exists, and create if it does not exist.

Events Data classes

class cognite.client.data_classes.events.EndTimeFilter(
max: int | None = None,
min: int | None = None,
is_null: bool | None = None,
)

Bases: CogniteResource

Either range between two timestamps or isNull filter condition.

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

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

  • is_null (bool | None) – Set to true if you want to search for data with field value not set, false to search for cases where some value is present.

class cognite.client.data_classes.events.Event(
id: int,
last_updated_time: int,
created_time: int,
external_id: str | None = None,
data_set_id: int | None = None,
start_time: int | None = None,
end_time: int | None = None,
type: str | None = None,
subtype: str | None = None,
description: str | None = None,
metadata: dict[str, str] | None = None,
asset_ids: Sequence[int] | None = None,
source: str | None = None,
)

Bases: WriteableCogniteResourceWithClientRef[EventWrite]

An event represents something that happened at a given interval in time, e.g a failure, a work order etc. This is the read version of the Event class. It is used when retrieving existing events.

Parameters:
  • id (int) – A server-generated ID for the object.

  • 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.

  • external_id (str | None) – The external ID provided by the client. Must be unique for the resource type.

  • data_set_id (int | None) – The id of the dataset this event belongs to.

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

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

  • type (str | None) – Type of the event, e.g. ‘failure’.

  • subtype (str | None) – SubType of the event, e.g. ‘electrical’.

  • description (str | None) – Textual description of the event.

  • metadata (dict[str, str] | None) – Custom, application-specific metadata. String key -> String value. Limits: Maximum length of key is 128 bytes, value 128000 bytes, up to 256 key-value pairs, of total size at most 200000.

  • asset_ids (Sequence[int] | None) – Asset IDs of equipment that this event relates to.

  • source (str | None) – The source of this event.

as_write() EventWrite

Returns this Event in its write version.

class cognite.client.data_classes.events.EventFilter(
start_time: dict[str, Any] | TimestampRange | None = None,
end_time: dict[str, Any] | EndTimeFilter | None = None,
active_at_time: dict[str, Any] | TimestampRange | None = None,
metadata: dict[str, str] | None = None,
asset_ids: Sequence[int] | None = None,
asset_external_ids: SequenceNotStr[str] | None = None,
asset_subtree_ids: Sequence[dict[str, Any]] | None = None,
data_set_ids: Sequence[dict[str, Any]] | None = None,
source: str | None = None,
type: str | None = None,
subtype: str | None = None,
created_time: dict[str, Any] | TimestampRange | None = None,
last_updated_time: dict[str, Any] | TimestampRange | None = None,
external_id_prefix: str | None = None,
)

Bases: CogniteFilter

Filter on events filter with exact match

Parameters:
  • start_time (dict[str, Any] | TimestampRange | None) – Range between two timestamps.

  • end_time (dict[str, Any] | EndTimeFilter | None) – Either range between two timestamps or isNull filter condition.

  • active_at_time (dict[str, Any] | TimestampRange | None) – Event is considered active from its startTime to endTime inclusive. If startTime is null, event is never active. If endTime is null, event is active from startTime onwards. activeAtTime filter will match all events that are active at some point from min to max, from min, or to max, depending on which of min and max parameters are specified.

  • metadata (dict[str, str] | None) – Custom, application specific metadata. String key -> String value. Limits: Maximum length of key is 128 bytes, value 128000 bytes, up to 256 key-value pairs, of total size at most 200000.

  • asset_ids (Sequence[int] | None) – Asset IDs of equipment that this event relates to.

  • asset_external_ids (SequenceNotStr[str] | None) – Asset External IDs of equipment that this event relates to.

  • asset_subtree_ids (Sequence[dict[str, Any]] | None) – Only include events that have a related asset in a subtree rooted at any of these assetIds. If the total size of the given subtrees exceeds 100,000 assets, an error will be returned.

  • data_set_ids (Sequence[dict[str, Any]] | None) – Only include events that belong to these datasets.

  • source (str | None) – The source of this event.

  • type (str | None) – Type of the event, e.g ‘failure’.

  • subtype (str | None) – SubType of the event, e.g ‘electrical’.

  • created_time (dict[str, Any] | TimestampRange | None) – Range between two timestamps.

  • last_updated_time (dict[str, Any] | TimestampRange | None) – Range between two timestamps.

  • external_id_prefix (str | None) – Filter by this (case-sensitive) prefix for the external ID.

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.events.EventList(
resources: Sequence[T_CogniteResource],
)

Bases: WriteableCogniteResourceList[EventWrite, Event], IdTransformerMixin

class cognite.client.data_classes.events.EventProperty(value)

Bases: EnumProperty

An enumeration.

class cognite.client.data_classes.events.EventUpdate(id: int | None = None, external_id: str | None = None)

Bases: CogniteUpdate

Changes will be applied to event.

Parameters:
  • id (int) – A server-generated ID for the object.

  • external_id (str) – The external ID provided by the client. Must be unique for the resource type.

class cognite.client.data_classes.events.EventWrite(
external_id: str | None = None,
data_set_id: int | None = None,
start_time: int | None = None,
end_time: int | None = None,
type: str | None = None,
subtype: str | None = None,
description: str | None = None,
metadata: dict[str, str] | None = None,
asset_ids: Sequence[int] | None = None,
source: str | None = None,
)

Bases: WriteableCogniteResource[EventWrite]

An event represents something that happened at a given interval in time, e.g a failure, a work order etc. This is the write version of the Event class. It is used when creating new events.

Parameters:
  • external_id (str | None) – The external ID provided by the client. Must be unique for the resource type.

  • data_set_id (int | None) – The id of the dataset this event belongs to.

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

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

  • type (str | None) – Type of the event, e.g. ‘failure’.

  • subtype (str | None) – SubType of the event, e.g. ‘electrical’.

  • description (str | None) – Textual description of the event.

  • metadata (dict[str, str] | None) – Custom, application-specific metadata. String key -> String value. Limits: Maximum length of key is 128 bytes, value 128000 bytes, up to 256 key-value pairs, of total size at most 200000.

  • asset_ids (Sequence[int] | None) – Asset IDs of equipment that this event relates to.

  • source (str | None) – The source of this event.

class cognite.client.data_classes.events.EventWriteList(
resources: Sequence[T_CogniteResource],
)

Bases: CogniteResourceList[EventWrite], ExternalIDTransformerMixin

class cognite.client.data_classes.events.SortableEventProperty(value)

Bases: EnumProperty

An enumeration.