Skip to main content
Question

Sdk instance query for grouping

  • March 21, 2025
  • 2 replies
  • 39 views

Hello Team,

We have three views:

→ ScalarProperty{

#other fields

entity: Entity

}

→ Entity{

#other fields

entitytype: EntityType

}

→ EntityType{

externalId

}

Given this, from ScalarProperty view, can we use groupby on entity.entityType.externalId when querying instances and counting them using the query API, or is there another way to achieve this?

2 replies

@Snehal Jagtap 


AndersM
Seasoned Practitioner
  • Seasoned Practitioner
  • March 24, 2025

Hi Shivani,

My understanding of the question is that you would like to perform a count of instances with the ScalarProperty view grouped by entity->entityType->externalId. I’m afraid this isn’t possible, as aggregation operations cannot perform graph traversal, even across just one relation. Aggregation operations have to scan all instances of a type to evaluate a query, so they are constrained to operating on primitive fields only, to make sure that queries can be executed in a timely fashion.

Thanks,

-AndersM