Skip to content

Fix : aggregate method typing to accept list of expressions - #246

Merged
evertlammerts merged 2 commits into
duckdb:mainfrom
Narwhal-fish:fix-DuckDBPyRelation.aggregate-incorrect-typing
Jan 6, 2026
Merged

Fix : aggregate method typing to accept list of expressions#246
evertlammerts merged 2 commits into
duckdb:mainfrom
Narwhal-fish:fix-DuckDBPyRelation.aggregate-incorrect-typing

Conversation

@Narwhal-fish

Copy link
Copy Markdown
Contributor

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: ...

@evertlammerts
evertlammerts changed the base branch from main to v1.4-andiumJanuary 5, 2026 12:01
@evertlammerts
evertlammerts changed the base branch from v1.4-andium to mainJanuary 5, 2026 12:01
@evertlammerts

Copy link
Copy Markdown
Member

Thanks, LGTM! Can you rebase on v1.4-andium?

@Narwhal-fish

Copy link
Copy Markdown
ContributorAuthor

Thanks, LGTM! Can you rebase on v1.4-andium?

Sure!

@Narwhal-fish
Narwhal-fishforce-pushed the fix-DuckDBPyRelation.aggregate-incorrect-typing branch from 90f4b3c to f2bc4faCompareJanuary 6, 2026 05:31
@evertlammerts
evertlammertsforce-pushed the fix-DuckDBPyRelation.aggregate-incorrect-typing branch from f2bc4fa to b845b35CompareJanuary 6, 2026 09:35
@evertlammerts
evertlammerts merged commit 45fb522 into duckdb:mainJan 6, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DuckDBPyRelation.aggregate has incorrect typing

2 participants

@Narwhal-fish@evertlammerts