Skip to main content
Question

Advanced filter on timeseries for None value property

  • March 6, 2026
  • 2 replies
  • 17 views

RAMBOURG Pierre
Committed

Hello Experts,

I’m trying to use advanced filter on timeseries through SDK. I can do what I want except in the following situation: the asset_id property is null. Can anyone help me?

I tried :

from cognite.client.data_classes.time_series import TimeSeriesProperty
f = filters.And(
filters.Equals("data_set_id", 123456),
filters.Equals("name", "foobar"),
filters.Equals(TimeSeriesProperty.asset_id, "")
)
[advancedFilter.[2].equals.value A string is not a valid value for the property "assetId"]
from cognite.client.data_classes.time_series import TimeSeriesProperty
f = filters.And(
filters.Equals("data_set_id", 123456),
filters.Not(filters.Exists(TimeSeriesProperty.asset_id)),
)
-> 0

I’m sure there is timeseries where timeseries.asset_id is None.

Thanks experts !

Regards,

Pierre Rambourg

2 replies

Shun Takase
MVP
Forum|alt.badge.img

How about taking a slightly different approach: first retrieve all the time series, and then filter the results on the client side to keep only the rows where asset_id is null?
For example, something like the following idea



I hope this idea is helpful in some way.


RAMBOURG Pierre
Committed

Hello ​@Shun Takase ,

Thank you for your reply. It works very well, but that's not what I'm interested in: I want the optimal solution!

In your solution, I have to unnecessarily query all timeseries, even though only a minority of them are eligible.

I would like a completely server-side solution, so my question extends to the other attributes of a timeseries that can be set to None!

Regards