Iterate over assets

async AsyncCogniteClient.assets.__call__(
chunk_size: int | None = None,
name: str | None = None,
parent_ids: Sequence[int] | None = None,
parent_external_ids: SequenceNotStr[str] | None = None,
asset_subtree_ids: int | Sequence[int] | None = None,
asset_subtree_external_ids: str | SequenceNotStr[str] | None = None,
metadata: dict[str, str] | None = None,
data_set_ids: int | Sequence[int] | None = None,
data_set_external_ids: str | SequenceNotStr[str] | None = None,
labels: LabelFilter | None = None,
geo_location: GeoLocationFilter | None = None,
source: str | None = None,
created_time: dict[str, Any] | TimestampRange | None = None,
last_updated_time: dict[str, Any] | TimestampRange | None = None,
root: bool | None = None,
external_id_prefix: str | None = None,
aggregated_properties: Sequence[Literal['child_count', 'path', 'depth']] | None = None,
limit: int | None = None,
advanced_filter: Filter | dict[str, Any] | None = None,
sort: AssetSort | str | SortableAssetProperty | tuple[str, Literal['asc', 'desc']] | tuple[str, Literal['asc', 'desc'], Literal['auto', 'first', 'last']] | list[AssetSort | str | SortableAssetProperty | tuple[str, Literal['asc', 'desc']] | tuple[str, Literal['asc', 'desc'], Literal['auto', 'first', 'last']]] | None = None,
) AsyncIterator[Asset] | AsyncIterator[AssetList]

Iterate over assets

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

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

  • name (str | None) – Name of asset. Often referred to as tag.

  • parent_ids (Sequence[int] | None) – Return only the direct descendants of the specified assets.

  • parent_external_ids (SequenceNotStr[str] | None) – Return only the direct descendants of the specified assets.

  • asset_subtree_ids (int | Sequence[int] | None) – Only include assets in subtrees rooted at any of the specified 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 assets in subtrees rooted at any of the specified assetExternalIds. If the total size of the given subtrees exceeds 100,000 assets, an error will be returned.

  • metadata (dict[str, str] | None) – Custom, application specific metadata. String key -> String value

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

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

  • labels (LabelFilter | None) – Return only the assets matching the specified label.

  • geo_location (GeoLocationFilter | None) – Only include files matching the specified geographic relation.

  • source (str | None) – The source of this asset

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

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

  • root (bool | None) – filtered assets are root assets or not

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

  • aggregated_properties (Sequence[AggregateAssetProperty] | None) – Set of aggregated properties to include. Options are childCount, path, depth.

  • limit (int | None) – Maximum number of assets 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.

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

Yields:

Asset | AssetList – yields Asset one by one if chunk_size is not specified, else AssetList objects.