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

sqlalchemy.dialects.postgresql.array([1, 2]) incorrectly rejected #188

Open
andersk opened this issue Nov 16, 2020 · 0 comments · May be fixed by #191
Open

sqlalchemy.dialects.postgresql.array([1, 2]) incorrectly rejected #188

andersk opened this issue Nov 16, 2020 · 0 comments · May be fixed by #191

Comments

@andersk
Copy link
Contributor

andersk commented Nov 16, 2020

This valid example from the SQLAlchemy documentation fails to type check:

from sqlalchemy.dialects.postgresql import array
from sqlalchemy.dialects import postgresql
from sqlalchemy import select, func

stmt = select([
                array([1,2]) + array([3,4,5])
            ])

print(stmt.compile(dialect=postgresql.dialect()))
$ python3 example.py
SELECT ARRAY[%(param_1)s, %(param_2)s] || ARRAY[%(param_3)s, %(param_4)s, %(param_5)s] AS anon_1

$ cat mypy.ini
[mypy]
plugins = sqlmypy

$ mypy example.py
example.py:6: error: No overload variant of "array" matches argument type "List[int]"
example.py:6: note: Possible overload variant:
example.py:6: note:     def array(self, clause: ColumnElement[Any], *clauses: ColumnElement[Any], **kw: Any) -> array
example.py:6: note:     <2 more non-matching overloads not shown>
Found 1 error in 1 file (checked 1 source file)

$ pip freeze
mypy==0.790
mypy-extensions==0.4.3
SQLAlchemy==1.3.20
sqlalchemy-stubs==0.3
typed-ast==1.4.1
typing-extensions==3.7.4.3
andersk added a commit to andersk/sqlalchemy-stubs that referenced this issue Nov 17, 2020
Fixes dropbox#188.

Signed-off-by: Anders Kaseorg <[email protected]>
@andersk andersk linked a pull request Nov 17, 2020 that will close this issue
andersk added a commit to andersk/sqlalchemy-stubs that referenced this issue Nov 17, 2020
Fixes dropbox#188.

Signed-off-by: Anders Kaseorg <[email protected]>
andersk added a commit to andersk/sqlalchemy-stubs that referenced this issue Dec 20, 2020
Fixes dropbox#188.

Signed-off-by: Anders Kaseorg <[email protected]>
andersk added a commit to andersk/sqlalchemy-stubs that referenced this issue Jul 3, 2022
Fixes dropbox#188.

Signed-off-by: Anders Kaseorg <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant