Aggregate Time Series Property Cardinality

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

Find approximate paths count for time series.

Parameters:
  • path (TimeSeriesProperty | str | list[str]) – 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 filter to narrow down the time series to count cardinality.

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

  • filter (TimeSeriesFilter | dict[str, Any] | None) – The filter to narrow down the time series to count requiring exact match.

Returns:

The number of properties matching the specified filters and search.

Return type:

int

Examples

Count the number of metadata keys in your CDF project:

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