Skip to content

Commit da5d721

Browse files
Follow up on stub fixes (#327)
@OutSquareCapital does this cover it?
2 parents d9fd442 + 894e715 commit da5d721

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

_duckdb-stubs/__init__.pyi

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ if pytyping.TYPE_CHECKING:
99
import polars
1010
import pandas
1111
import pyarrow.lib
12-
from collections.abc import Callable, Sequence, Mapping
12+
from collections.abc import Callable, Iterable, Sequence, Mapping
1313
from duckdb import sqltypes, func
1414

1515
# the field_ids argument to to_parquet and write_parquet has a recursive structure
@@ -476,7 +476,7 @@ class DuckDBPyRelation:
476476
def __getitem__(self, name: str) -> DuckDBPyRelation: ...
477477
def __len__(self) -> int: ...
478478
def aggregate(
479-
self, aggr_expr: str | Expression | list[Expression | str], group_expr: Expression | str = ""
479+
self, aggr_expr: str | Iterable[Expression | str], group_expr: Expression | str = ""
480480
) -> DuckDBPyRelation: ...
481481
def any_value(
482482
self, expression: str, groups: str = "", window_spec: str = "", projected_columns: str = ""
@@ -1067,10 +1067,10 @@ def DefaultExpression() -> Expression: ...
10671067
def FunctionExpression(function_name: str, *args: Expression) -> Expression: ...
10681068
def LambdaExpression(lhs: pytyping.Any, rhs: Expression) -> Expression: ...
10691069
def SQLExpression(expression: str) -> Expression: ...
1070-
def StarExpression(*, exclude: list[str | Expression] | None = None) -> Expression: ...
1070+
def StarExpression(*, exclude: Iterable[str | Expression] | None = None) -> Expression: ...
10711071
def aggregate(
10721072
df: pandas.DataFrame,
1073-
aggr_expr: Expression | list[Expression] | str | list[str],
1073+
aggr_expr: str | Iterable[Expression | str],
10741074
group_expr: str = "",
10751075
*,
10761076
connection: DuckDBPyConnection | None = None,

src/duckdb_py/pyrelation.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,7 @@ vector<unique_ptr<ParsedExpression>> GetExpressions(ClientContext &context, cons
248248
auto aggregate_list = std::string(py::str(expr));
249249
return Parser::ParseExpressionList(aggregate_list, context.GetParserOptions());
250250
} else {
251+
// A single Expression could be supported here by wrapping it in a vector
251252
string actual_type = py::str(py::type::of(expr));
252253
throw InvalidInputException("Please provide either a string or list of Expression objects, not %s",
253254
actual_type);

0 commit comments

Comments
 (0)