Skip to content

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

Open
@andersk

Description

@andersk
Contributor

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

Activity

added a commit that references this issue on Nov 17, 2020
6099ec2
linked a pull request that will close this issue on Nov 17, 2020
added a commit that references this issue on Nov 17, 2020
98440c4
added a commit that references this issue on Dec 20, 2020
a037c19
added a commit that references this issue on Jul 3, 2022
0c4d7a6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @andersk

      Issue actions

        sqlalchemy.dialects.postgresql.array([1, 2]) incorrectly rejected · Issue #188 · dropbox/sqlalchemy-stubs