dropbox / sqlalchemy-stubs

Mypy plugin and stubs for SQLAlchemy
Apache License 2.0
570 stars 101 forks source link

Select __init__ rejecting Column only accepts ColumnElement. #235

Open BobACollins opened 2 years ago

BobACollins commented 2 years ago

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