sqlalchemy-stubs icon indicating copy to clipboard operation
sqlalchemy-stubs copied to clipboard

Select __init__ rejecting Column only accepts ColumnElement.

Open BobACollins opened this issue 3 years ago • 0 comments

I think a the select init accepts a Column but, it isn't listed in the Union of types. It looks like an easy fix but, I don't know this well enough to have confidence.

Example Code stolen from sqlalchemy docs as example.

from sqlalchemy import table, column, select

user = table("user",
        column("id"),
        column("name"),
        column("description"),
)

stmt = select(user.c.description).where(user.c.name == 'wendy')

Results in error: Argument 1 to "Select" has incompatible type "Column[Any]"; expected "Optional[Iterable[Union[ColumnElement[Any], FromClause, int]]]"

Versions

mypy==0.931
mypy-extensions==0.4.3
sqlalchemy==1.4.31
sqlalchemy-stubs==0.4
tomli==2.0.0

BobACollins avatar Jan 27 '22 17:01 BobACollins