Aggregate Asset Property Cardinality

async AsyncCogniteClient.assets.aggregate_cardinality_properties(
path: AssetProperty | str | list[str],
advanced_filter: Filter | dict[str, Any] | None = None,
aggregate_filter: AggregationFilter | dict[str, Any] | None = None,
filter: AssetFilter | dict[str, Any] | None = None,
) int

Find approximate paths count for assets.

Parameters:
  • path (AssetPropertyLike) – The scope in every document to aggregate properties. The only value allowed now is [“metadata”]. It means to aggregate only metadata properties (aka keys).

  • advanced_filter (Filter | dict[str, Any] | None) – The advanced filter to narrow down assets.

  • aggregate_filter (AggregationFilter | dict[str, Any] | None) – The filter to apply to the resulting buckets.

  • filter (AssetFilter | dict[str, Any] | None) – The filter to narrow down assets (strict matching).

Returns:

The number of properties matching the specified filters.

Return type:

int

Examples

Count the number of unique metadata keys used by assets in your CDF project:

>>> from cognite.client import CogniteClient
>>> from cognite.client.data_classes.assets import AssetProperty
>>> client = CogniteClient()
>>> # async_client = AsyncCogniteClient()  # another option
>>> key_count = client.assets.aggregate_cardinality_properties(AssetProperty.metadata)