Skip to main content
Solved

Wildcard listing resources

  • September 28, 2022
  • 3 replies
  • 67 views

Anders Brakestad
Seasoned

I am listing time series for a given asset, and get a lot of results. I need to filter based on the time series external ID, but the only option is by using the “external_id_prefix” argument to the list function. So I build up the prefix left to right. Somewhere in the external id is a parameter that I do not care about, and after comes a new parameter that I want a particular value of. Concrete example of external IDs:

IAA_Miros_Weather_Data_WIA_008
IAA_Miros_Weather_Data_WIB_008
IAA_Miros_Weather_Data_WIC_008
IAA_Miros_Weather_Data_WID_008
IAA_Miros_Weather_Data_WIE_008

I am interested in only getting time series with external IDs that contain “_WI” and that end with “008”. Is there a way to list time series with a wildcard? Something like this:

client.time_series.list(
    asset_ids=[my_asset_id],
    limit=None,
    external_id_prefix="IAA_Miros_Weather_Data_WI*_008",
    partitions=4
)

I could of course obtain the relevant time series by filtering after the fact. Something like this

result = client.time_series.list(
    asset_ids=[my_asset_id],
    limit=None,
    external_id_prefix="IAA_Miros_Weather_Data_WI",
    partitions=4
).to_pandas()
df = result.loc[result.externalId.str.endswith("008")]

Or is there functionality already available?

Sincerely,

Anders Brakestad

Best answer by Gaetan Helness

Hi Anders, 

There is not any fuzzy search on the externalID field, but we do support fuzzy search on the name and description. 

https://docs.cognite.com/api/v1/#tag/Time-series/operation/searchTimeSeries
Depending on the data model, do you have possibility to filter on that information somewhere else like the metadata field for example? 

If not, I guess filtering after the fact is a way to go as well. 

 

View original
Did this topic help you find an answer to your question?

Forum|alt.badge.img

Hi Anders, 

There is not any fuzzy search on the externalID field, but we do support fuzzy search on the name and description. 

https://docs.cognite.com/api/v1/#tag/Time-series/operation/searchTimeSeries
Depending on the data model, do you have possibility to filter on that information somewhere else like the metadata field for example? 

If not, I guess filtering after the fact is a way to go as well. 

 


  • Seasoned Practitioner
  • October 10, 2022

Hi @Anders Brakestad, did Gaetan’s reply above help you? 


Anders Brakestad
Seasoned

Hi again,

Yes, I answer clarified some restrictions on searching and filtering. In the specific case in the original post, I cannot filter on this parameter in the metadata, so I need to do it ad hoc.

Thanks for the help!


Reply


Cookie Policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie Settings