I’m using python function in a Code repository, to query and execute aggregation on my Ontology.
When I’m aggregating on a property, the default behavior is for nulls to be excluded from the aggregation.
The documentation of the v2 API on Objects indicates that there is a parameter to include nulls in those aggregation.
See https://www.palantir.com/docs/foundry/api/v2/ontologies-v2-resources/ontology-objects/aggregate-objects
However, in code repository, even with a SDK generated in the latest version (2.x.0), it doesn’t look like this parameter is available.
from functions.api import function, Date, Integer, String
from datetime import timedelta
from typing import Optional
from ontology_sdk import FoundryClient
from ontology_sdk.ontology.objects import Cars
from foundry_sdk_runtime.aggregations import (
AggregateObjectsResponse,
AggregateObjectsResponseItem,
AggregationMetricResult
)
from functions.api import OntologyEdit
import logging
logging.basicConfig(format='%(levelname)s:%(message)s', level=logging.DEBUG)
@function
def example_group_by_function() -> str:
client = FoundryClient()
Cars_counts: AggregateObjectsResponse = (
client.ontology.objects.Cars
.group_by(Cars.object_type.vehicle_id_number.exact()) ## << This doesn't have an "includeNullValues" parameter, but has "max_group_count"
.count()
.compute()
)
group_1: AggregateObjectsResponseItem = Cars_counts.data[0]
logging.info("QUERY")
logging.info(group_1.group)
# Example output:
# {"vehicleIdNumber": "group value"}
logging.info(group_1.metrics)
# Example output:
# [AggregationMetricResult(name="count", value=100.0)]
return "test"
Question: Is it expected that this parameter is not available in code repository directly ? Is there a way to use this “includeNullValues” ?
