Skip to content

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

@andersk

Description

@andersk

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions