Skip to content

AggregationThreshold

Source code in docs_src/capo_cleanrooms/types/aggregation_threshold.py
class AggregationThreshold(TypedDict, closed=True):
    identity_columns: (
        "capo_cleanrooms.types.analysis_rule_column_list.AnalysisRuleColumnList"
    )
    """<p>The identity column, such as <code>user_id</code>, whose distinct values Clean Rooms counts to enforce minimum aggregation thresholds. Currently, you can specify only one column, and its data type must be string, varchar, or char.</p>"""
    minimum_identity_count: "int"
    """<p>The minimum number of distinct identities that each query output group must represent. This threshold applies to all output columns in the table. To override this threshold for a specific column, use <code>outputColumnThresholds</code>.</p>"""
    type: "capo_cleanrooms.types.aggregation_threshold_type.AggregationThresholdType"
    """<p>The type of aggregation that the threshold enforces. Currently, the only supported value is <code>COUNT_DISTINCT</code>, which counts the distinct values in the identity column.</p>"""
    output_column_thresholds: NotRequired[
        "capo_cleanrooms.types.output_column_threshold_list.OutputColumnThresholdList"
    ]
    """<p>The per-column overrides of <code>minimumIdentityCount</code>. An output column without an override uses <code>minimumIdentityCount</code>.</p>"""
    allowed_aggregate_expression_type: "capo_cleanrooms.types.allowed_aggregate_expression_type.AllowedAggregateExpressionType"
    """<p>Specifies whether a query can aggregate a transformed column. This applies to the arguments of both aggregate and window functions. Valid values are:</p> <p> <code>COLUMNS_ONLY</code> – A query can aggregate only a direct column reference, such as <code>SUM(amount)</code>, or a constant. Clean Rooms rejects a query that transforms a column and then aggregates it, such as <code>SUM(amount * 2)</code> or <code>SUM(ROUND(amount))</code>.</p> <p> <code>ANY_EXPRESSION</code> – A query can aggregate any expression. This includes arithmetic, such as <code>SUM(price * quantity)</code>; a cast, such as <code>SUM(CAST(amount AS DECIMAL))</code>; a nested function call, such as <code>SUM(COALESCE(amount, 0))</code>; and a conditional, such as <code>SUM(CASE WHEN region = 'EU' THEN amount ELSE 0 END)</code>.</p>"""

allowed_aggregate_expression_type instance-attribute

allowed_aggregate_expression_type: AllowedAggregateExpressionType

Specifies whether a query can aggregate a transformed column. This applies to the arguments of both aggregate and window functions. Valid values are:

COLUMNS_ONLY – A query can aggregate only a direct column reference, such as SUM(amount), or a constant. Clean Rooms rejects a query that transforms a column and then aggregates it, such as SUM(amount * 2) or SUM(ROUND(amount)).

ANY_EXPRESSION – A query can aggregate any expression. This includes arithmetic, such as SUM(price * quantity); a cast, such as SUM(CAST(amount AS DECIMAL)); a nested function call, such as SUM(COALESCE(amount, 0)); and a conditional, such as SUM(CASE WHEN region = 'EU' THEN amount ELSE 0 END).

identity_columns instance-attribute

identity_columns: AnalysisRuleColumnList

The identity column, such as user_id, whose distinct values Clean Rooms counts to enforce minimum aggregation thresholds. Currently, you can specify only one column, and its data type must be string, varchar, or char.

minimum_identity_count instance-attribute

minimum_identity_count: int

The minimum number of distinct identities that each query output group must represent. This threshold applies to all output columns in the table. To override this threshold for a specific column, use outputColumnThresholds.

output_column_thresholds instance-attribute

output_column_thresholds: NotRequired[OutputColumnThresholdList]

The per-column overrides of minimumIdentityCount. An output column without an override uses minimumIdentityCount.

type instance-attribute

The type of aggregation that the threshold enforces. Currently, the only supported value is COUNT_DISTINCT, which counts the distinct values in the identity column.