Skip to main content
Question

Data Modeling - aggregate instances

  • 18 June 2024
  • 2 replies
  • 32 views

I am using the Python SDK endpoint to aggregate instances and passing an advanced Filter to the filter argument, i.e.:

client.data_modeling.instances.aggregate(…, filter = Filter(...))

But Nested filtering is not supported. It seems like the aggregate function only works on flat tables.

So I am considering to create a solution data model with only flat tables. I am considering to split up the data over multiple containers in order to support the number of indexes I would like to have. My question is whether splitting up over multiple containers negatively affect performance at query time and how does this compare to trying to limit the number of indexes instead?

 

2 replies

Userlevel 1
Badge +2

Hi Haaland,

Could you please share the code that you have used in the Python SDK. May be I can check that with the engineers and try to suggest a solution to you.

Best regards,

Pasindu Perera

Badge

Hi, 

The code for aggregating below. You will see that you get an error since Nested is not supported.

Why is is that Nested filters are not supported?

filter=And(
Nested(
scope=LOCATION_VIEW.as_property_ref("load_location"),
filter=In(LOCATION_VIEW.as_property_ref('region'), load_regions)),
Range(MAIN_VIEW.as_property_ref('load_start_timestamp'), gt=pd.Timestamp(start_date).isoformat(), lt=pd.Timestamp(end_date).isoformat()),
)

res = client.data_modeling.instances.aggregate(
view=MAIN_VIEW,
aggregates=aggs.Sum("quantity"),
group_by="group",
filter=filter,
limit=None,
)

 

Reply