# Aggregation in v2 functions - includesNulls parameter

**URL:** <https://community.palantir.com/t/aggregation-in-v2-functions-includesnulls-parameter/5336>\
**Category:** Ask the Community\
**Tags:** osdk, functions, python-functions\
**Created:** [October 28, 2025, 1:25pm UTC](https://community.palantir.com/t/aggregation-in-v2-functions-includesnulls-parameter/5336 "2025-10-28T13:25:51Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![VincentF](https://avatars.discourse-cdn.com/v4/letter/v/8491ac/32.png) [@VincentF](https://community.palantir.com/u/VincentF)\
**Post date:** [October 28, 2025, 1:25pm UTC](https://community.palantir.com/t/aggregation-in-v2-functions-includesnulls-parameter/5336/1 "2025-10-28T13:25:51Z")

</div>

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.

 ![image](https://canada1.discourse-cdn.com/palantir/original/2X/b/ba8203008daf493c8aaf7e69d0ab83af89b78f24.png)

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.

```auto
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” ?

---

<div class="post-metadata">

**Author:** ![system](https://yyz1.discourse-cdn.com/palantir/user_avatar/community.palantir.com/system/32/3_2.png) [@system](https://community.palantir.com/u/system)\
**Post date:** [October 23, 2026, 1:26pm UTC](https://community.palantir.com/t/aggregation-in-v2-functions-includesnulls-parameter/5336/2 "2026-10-23T13:26:17Z")

</div>

Closed on October 23, 2026, 1:26pm UTC

This topic was automatically closed 360 days after the last reply. New replies are no longer allowed.
