Skip to main content
Question

Using query api for large number of edges

  • July 17, 2025
  • 3 replies
  • 23 views

Hello,

I am working with the Cognite Data Modeling API to validate edges in a large data set. Our edges do not have a dedicated "edge view" defined in the model. When I attempt to use the instances.query() API to fetch edges filtered by their type, I encounter errors or unexpected behavior indicating that selected properties do not match the view schema.

Specifically, filtering or selecting on properties such as "externalId" fails because the queried view does not explicitly contain those properties, as the edges exist only as instances without a separate view.

Is there a recommended approach or best practice for querying and validating edges in scenarios where no dedicated edge view is defined? Should we rely exclusively on the instances.list() API with filters, or is there a way to construct valid queries for edges in the current model setup?

Any guidance on how to effectively query and validate edges in such cases, especially for large-scale data, would be appreciated.

Thank you!

3 replies

cc : ​@Snehal Jagtap ​@Sonali Vishal Patil ​@Shweta 


Anders  Albert
Seasoned Practitioner
Forum|alt.badge.img
  • Seasoned Practitioner
  • July 17, 2025

It is hard to answer this one as I do not know what errors and unexpected behavior your are encountering.

 

However, I can answer generically. If you are just fetching edges of a specific type I would simply use the `.list()` method (assuming you are talking about the PythonSDK, ‘cognite-sdk’). This takes care of pagination for you. If you want to run a memory efficient pagination, you can use the iterator 

for edges in client.data_modeling.instances(chunk_size=1000, space="edge_space", instance_type="edge"):
print(f"Do something with the {len(edges)} edges")

 


Mithila Jayalath
Seasoned Practitioner
Forum|alt.badge.img+8

@Shivani Mishra is your issue resolved now?