From 0c4d7a6976926bb64d7dd4c8f4012b33057e0f59 Mon Sep 17 00:00:00 2001 From: Anders Kaseorg Date: Mon, 16 Nov 2020 16:59:01 -0800 Subject: [PATCH] Fix PostgreSQL array type Fixes #188. Signed-off-by: Anders Kaseorg --- sqlalchemy-stubs/dialects/postgresql/array.pyi | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/sqlalchemy-stubs/dialects/postgresql/array.pyi b/sqlalchemy-stubs/dialects/postgresql/array.pyi index 03f7247..5ec5728 100644 --- a/sqlalchemy-stubs/dialects/postgresql/array.pyi +++ b/sqlalchemy-stubs/dialects/postgresql/array.pyi @@ -1,5 +1,5 @@ -from typing import Any as _AnyType, Optional, TypeVar, Type, Callable, overload -from ...sql import expression +from typing import Any as _AnyType, Optional, Sequence, TypeVar, Type, Union, Callable, overload +from ...sql import ColumnElement, expression from ...sql.type_api import TypeEngine from ... import types as _sqltypes @@ -8,7 +8,14 @@ _T = TypeVar('_T') def Any(other: _AnyType, arrexpr: _AnyType, operator: Callable[..., _AnyType] = ...) -> _AnyType: ... def All(other: _AnyType, arrexpr: _AnyType, operator: Callable[..., _AnyType] = ...) -> _AnyType: ... -class array(expression.Tuple): ... +class array(expression.Tuple[_T]): + def __init__( + self, + clauses: Sequence[Union[_T, ColumnElement[_T]]], + type_: Optional[Union[TypeEngine[_T], Type[TypeEngine[_T]]]] = ..., + **kw: _AnyType, + ) -> None: ... + class ARRAY(_sqltypes.ARRAY[_T]): @overload def __init__(self, item_type: TypeEngine[_T], as_tuple: bool = ..., dimensions: Optional[_AnyType] = ...,