Skip to main content
Practitioner ⭐️
Apr 25, 2024 5:30 PM UTC
Solved

CDF Transformations filter at dataset level

Is there a way to query metadata of TimeSeries from a particular dataset in CDF Transformations?

Something like this, but this query isn’t working

select
  cast(`externalId` as STRING) as externalId,
  cast(`dataSetId` as STRING) as eid
from
  `_cdf`.`timeseries`
where dataSetId == <data_set_id>;

Practitioner ⭐️
May 31, 2024 2:17 PM UTC

Yes it did. THanks

6 replies

Everton Colling
Expert ⭐️⭐️⭐️⭐️
Expert ⭐️⭐️⭐️⭐️
Apr 25, 2024 6:09 PM UTC

Hi Jatin,

The query you shared works fine. I just tested it on my side, both in the Fusion UI and using the API, as below:

Can you confirm if you passing the dataSetId as an integer?

Gaetan  Helness
MVP ⭐️⭐️⭐️⭐️⭐️
MVP ⭐️⭐️⭐️⭐️⭐️
Apr 25, 2024 6:18 PM UTC

I agree with @Everton Colling , also tested on my side in the UI
with both 

where dataSetId == 638923115923336 OR

where dataSetId == ‘638923115923336’

It returns everything as expected. 

What message do you get? 

If you are looking to see the metadata of the timeseries, you can add “select metadata as metadata” to your query

Practitioner ⭐️
Apr 25, 2024 6:28 PM UTC

Thanks. I think I was using dataset name instead of ID. But thanks once again !!!

Expert ⭐️⭐️⭐️⭐️
Apr 25, 2024 8:00 PM UTC

@Jatin Sablok , There’s a builtin CDF function for this:
https://docs.cognite.com/cdf/integration/guides/transformation/write_sql_queries#dataset_id

you use the external_id and it will resolve the id for you.  Scales across cdf dev/stage/prod projects this way:)
Jason

Dilini Fernando
Expert ⭐️⭐️⭐️⭐️
Expert ⭐️⭐️⭐️⭐️
May 31, 2024 11:32 AM UTC

Hi @Jatin Sablok,

Has the information provided helped address your concerns?

 

Jatin SablokAuthorAnswer
Practitioner ⭐️
May 31, 2024 2:17 PM UTC

Yes it did. THanks