Skip to content

Commit 45fb522

Browse files
Fix : aggregate method typing to accept list of expressions (#246)
Fixes #209 The type stub for `DuckDBPyRelation.aggregate` incorrectly restricts the `aggr_expr` parameter to `Expression | str`. However, the DuckDB Python API and runtime behavior also support passing a list of `Expression` objects for multiple aggregations. The fix extends the type annotation to include `list[Expression]`, aligning the stub definition with the actual supported API behavior. ``` def aggregate( self, aggr_expr: Expression | str | list[Expression], group_expr: Expression | str = "" ) -> DuckDBPyRelation: ... ```
2 parents 14a86f5 + 6d6f2fb commit 45fb522

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

_duckdb-stubs/__init__.pyi

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,9 @@ class DuckDBPyRelation:
461461
def __getattr__(self, name: str) -> DuckDBPyRelation: ...
462462
def __getitem__(self, name: str) -> DuckDBPyRelation: ...
463463
def __len__(self) -> int: ...
464-
def aggregate(self, aggr_expr: Expression | str, group_expr: Expression | str = "") -> DuckDBPyRelation: ...
464+
def aggregate(
465+
self, aggr_expr: Expression | str | list[Expression], group_expr: Expression | str = ""
466+
) -> DuckDBPyRelation: ...
465467
def any_value(
466468
self, column: str, groups: str = "", window_spec: str = "", projected_columns: str = ""
467469
) -> DuckDBPyRelation: ...

0 commit comments

Comments
 (0)