Iterate over events

async AsyncCogniteClient.events.__call__(
chunk_size: int | None = None,
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,
type: str | None = None,
subtype: str | None = None,
metadata: dict[str, str] | None = None,
asset_ids: Sequence[int] | None = None,
asset_external_ids: SequenceNotStr[str] | None = None,
asset_subtree_ids: int | Sequence[int] | None = None,
asset_subtree_external_ids: str | SequenceNotStr[str] | None = None,
data_set_ids: int | Sequence[int] | None = None,
data_set_external_ids: str | SequenceNotStr[str] | None = None,
source: 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,
sort: EventSort | str | SortableEventProperty | tuple[str, Literal['asc', 'desc']] | tuple[str, Literal['asc', 'desc'], Literal['auto', 'first', 'last']] | list[EventSort | str | SortableEventProperty | tuple[str, Literal['asc', 'desc']] | tuple[str, Literal['asc', 'desc'], Literal['auto', 'first', 'last']]] | None = None,
limit: int | None = None,
advanced_filter: Filter | dict[str, Any] | None = None,
) AsyncIterator[Event] | AsyncIterator[EventList]

Iterate over events

Fetches events as they are iterated over, so you keep a limited number of events in memory.

Parameters:
  • chunk_size (int | None) – Number of events to return in each chunk. Defaults to yielding one event a time.

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

  • end_time (dict[str, Any] | EndTimeFilter | None) – Range between two timestamps

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

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

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

  • metadata (dict[str, str] | None) – Customizable extra data about the event. String key -> String value.

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

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

  • asset_subtree_ids (int | Sequence[int] | 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.

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

  • data_set_ids (int | Sequence[int] | None) – Return only events in the specified data set(s) with this id / these ids.

  • data_set_external_ids (str | SequenceNotStr[str] | None) – Return only events in the specified data set(s) with this external id / these external ids.

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

  • created_time (dict[str, Any] | TimestampRange | None) – Range between two timestamps. Possible keys are min and max, with values given as time stamps in ms.

  • last_updated_time (dict[str, Any] | TimestampRange | None) – Range between two timestamps. Possible keys are min and max, with values given as time stamps in ms.

  • external_id_prefix (str | None) – External Id provided by client. Should be unique within the project

  • sort (SortSpec | list[SortSpec] | None) – The criteria to sort by. Defaults to desc for _score_ and asc for all other properties. Sort is not allowed if partitions is used.

  • limit (int | None) – Maximum number of events to return. Defaults to return all items.

  • advanced_filter (Filter | dict[str, Any] | None) – Advanced filter query using the filter DSL (Domain Specific Language). It allows defining complex filtering expressions that combine simple operations, such as equals, prefix, exists, etc., using boolean operators and, or, and not.

Yields:

Event | EventList – yields Event one by one if chunk_size is not specified, else EventList objects.