Skip to main content
Seasoned ⭐️⭐️
January 30, 2025
Solved

Need dump yaml for instances deployment by CDF Toolkit

  • January 30, 2025
  • 11 replies
  • 150 views

I want to upload instances using CDF Toolkit. For example, data model I can get dump yaml from existing data model using toolkit like following:

cdf dump datamodel

I want to get the dump yaml of instances from my existing space and data model which I can use it to later deploy using toolkit to different space or env.

 

I checked the doc here: https://docs.cognite.com/cdf/deploy/cdf_toolkit/references/resource_library#nodes

But creating yaml file manually would be too hard. I have also tried to get dump yaml using python sdk but that dump yaml looks incomplete to be used for deployment.

Best answer by Anders Albert

Currently, Toolkit does not support dumping of instances, but I will note it as a feature request. 

The workaround would be to use the PySDK to create the yaml files. The you can do something like this

 

retrieved = client.data_modeling.instances.retrieve(nodes=my_node_ids, edges=my_edge_ids)
Path("my_nodes.Node.yaml").write_text(retrieved.nodes.as_write().dump_yaml(), encoding="utf-8")
Path("my_edges.Edge.yaml").write_text(retrieved.edges.as_write().dump_yaml(), encoding="utf-8")

Notice the `.as_write()` method this converts the nodes from the response/read format to the request/write format that Toolkit needs. 

11 replies

Seasoned ⭐️⭐️
February 13, 2025

@Khilesh Sahu We have release Toolkit `v0.4.7` which has alpha support for populating nodes through a view from a csv or parquet file. 

You enable it in the `cdf.toml` with the following

[alpha_flags]
populate=true

The command is `cdf populate view`. 

Is there any documentation available for it where I can see details like what are required steps before  ‘cdf populate view’ and where to place csv files.

Need details like expected population rate and maximum num of instances we can populate. 

Please share if there is any documentation available and expected release date so that we can analyze it to deploy in prod