Skip to main content
Question

Having different results using different method of SDK generated by Pygen

  • March 20, 2025
  • 2 replies
  • 29 views

Marwen TALEB
MVP

Hello, 

 

We are currently the Pygen (cognite-pygen==1.0.2) to generate an SDK of our data model. While testing a use case where we want to query all Casings of all Onshore Wells we notice that we get different results using the `List` and `Select` methods.

 

# First method of querying

wells = dm_client.well.list(product_line='Onshore', retrieve_connections='identifier',limit=-1)
direct_relations = []
for w in wells:
if w.wellbores:
for wb in w.wellbores:
wb_ext=wb.external_id
inst = dm.DirectRelationReference(wb.space, wb_ext)
direct_relations.append(inst)
wb_sections = dm_client.wellbore_section.list(wellbore=direct_relations, retrieve_connections='full', limit=-1)
casings = wb_sections.casing
print(f'casings: {len(casings)}') # casings: 645

# Second method of querying

casings= dm_client.well.select().product_line.equals('Onshore').wellbores.wellbore_sections.casing.list_casing(limit=-1)
print(f'casings: {len(casings)}') # casings: 94



Any thing we missing here? Could you please take a look?

 

Thanks

2 replies

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

@Marwen TALEB I’ll check on this and get back to you with an update.


Anders  Albert
Seasoned Practitioner
Forum|alt.badge.img
  • Seasoned Practitioner
  • March 25, 2025

This has already been reported, so I am currently looking into it 😃.

I struggle to recreate it, maybe you can help me, which data model is this?