Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incompatible type in values #228

Open
mdczaplicki opened this issue Sep 6, 2022 · 1 comment
Open

Incompatible type in values #228

mdczaplicki opened this issue Sep 6, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@mdczaplicki
Copy link

Sorry, I don't have much time, but mypy screams here:

my_valyes = values(
    column("x", Integer),   # here
    column("y", Integer),  # and here
    name="my_values",
).data(my_values_data)

with:

error: Argument 1 to "Values" has incompatible type "ColumnClause[Integer]"; expected "Column[Any]"
error: Argument 2 to "Values" has incompatible type "ColumnClause[Integer]"; expected "Column[Any]"

stubs version 0.0.2a6

@mdczaplicki mdczaplicki added the requires triage New issue that requires categorization label Sep 6, 2022
@CaselIT CaselIT added bug Something isn't working and removed requires triage New issue that requires categorization labels Sep 6, 2022
@peterschutt
Copy link
Contributor

I tried to repro.

Env (also tried with 0.0.2a27):

(.venv) peter@peter-Inspiron-15-5510:~/PycharmProjects/sqla-stubs-228$ pip freeze
greenlet==1.1.3
mypy==0.971
mypy-extensions==0.4.3
SQLAlchemy==1.4.41
sqlalchemy2-stubs==0.0.2a26
tomli==2.0.1
typing_extensions==4.3.0

and

# main.py
from sqlalchemy import Integer, column, values

my_values = values(
    column("x", Integer),   # here
    column("y", Integer),  # and here
    name="my_values",
).data({})

reveal_type(my_values)

Result:

(.venv) peter@peter-Inspiron-15-5510:~/PycharmProjects/sqla-stubs-228$ mypy main.py 
main.py:9: note: Revealed type is "sqlalchemy.sql.selectable.Values"
Success: no issues found in 1 source file

The type of *columns param to Values changed from Column to ColumnClause[Any] in 0.0.2a12

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants