cognitedata/cognite-sdk-python

Aggregates as a Literal

doctrino opened this issue · 0 comments

          I like introducing the possible aggregates as a Literal, but I wonder if we should move it to a different PR?

We already have ALL_SORTED_DP_AGGS in cognite/client/data_classes/datapoints.py, and we could then change its definition to something like:

Aggregate = Literal[
    [
        "average",
        "continuous_variance",
        "count",
        ...,
    ]
]
ALL_SORTED_DP_AGGS = sorted(typing.get_args(Aggregate))

Regardless:

  • In either case, remove the plural "s" from Aggregates.
  • Accept camel case and snake case, but use snake case in the Literal to be consistent with the documentation on the other retrieve-X methods

Originally posted by @haakonvt in #1189 (comment)