Skip to main content
Seasoned ⭐️
May 10, 2024
Solved

Downloading list of timeseries with metadata?

  • May 10, 2024
  • 15 replies
  • 249 views

I am looking at 127 time series linked to one asset and I want to download the list of these time series as shown in the screenshot below, but this doesn’t appear to be straight forward.

  1. The download button circled in blue saves a JSON file linked only to the asset “11. QHP”. Is there a way to spare the user the effort of manually selecting and downloading each of the 127 timeseries and later reassemble them into one table like the one shown in the browser? 
  2. It is not possible to select and display more than 20 columns in the browser … due to performance issues. This is not critical at this time, but still dissatisfying. I want to download everything wholesale and pick what I need from the list locally. Is there a way around this restriction? Solving issue #1 would remedy also #2, as I’d be able to join the tables locally again.

 

Thanks

Best answer by roman.chesnokov

Yes, correct. Then, we should go from the asset subtree. There is a code snippet for you.

from cognite.client import CogniteClient
client = CogniteClient()

asset_xid = "houston.11. QHP"

asset_tree = client.assets.retrieve_subtree(external_id=asset_xid)
asset_tree.time_series().to_pandas().to_csv(f"Timeseries for {asset_xid}.csv")

Let me know if it fits your needs.

15 replies

Seasoned ⭐️
October 15, 2024

@roman.chesnokov, thanks! Again, very useful. It’s weird. I am almost definitely certain I used to run this code locally as I’ve pasted it in above without problems. I’ve never as much as touched the Notebooks in CDF. Alas, it works in the CDF notebook now. 

 

FYI, locally, before every CDF “session” I run the below. 

 

I can still download timeseries using a local Notebook:

 

As a result, it was both surprising and frustrating to note that I can’t download metadata in the same notebook.

roman.chesnokov
Expert ⭐️⭐️⭐️⭐️
Expert ⭐️⭐️⭐️⭐️
October 15, 2024

Ah, I see! then you just reinstantiate the client with an empty config. Just remove those 2 lines, it should work then. 

 

Seasoned ⭐️
October 15, 2024

@roman.chesnokov, wow, it works now. That’s cool. Thanks for resolving yet another issue! I’m relieved. Have a great day!

Sofie Svartdal Berge
Expert ⭐️⭐️⭐️⭐️
Expert ⭐️⭐️⭐️⭐️
November 11, 2024

Hi @Patrick Galler !
I wanted to pop by and let you know that we also plan to enable a direct download of a curated list of events, time series, files, assets, or instances of a Data Modeling view in the Q1 release next year. This will be from the Search interface. 

Best, 

Sofie Berge, Product Manager

 

Seasoned ⭐️
November 12, 2024

Thank you @Sofie Svartdal Berge. Unfortunately, I think we’ll be quitting CDF by end of this year.