dropbox / sqlalchemy-stubs

Mypy plugin and stubs for SQLAlchemy
Apache License 2.0
570 stars 101 forks source link

DDL().execute_if(dialect='...') has incorrect type definition #181

Open jace opened 3 years ago

jace commented 3 years ago

mypy raised an error on this code:

DDL(stmt).execute_if(dialect='postgresql')

error: Argument "dialect" to "execute_if" of "DDLElement" has incompatible type "str"; expected "Optional[Dialect]"

However, the documentation for this method and source code suggest that the expected type is:

Optional[Union[str, Tuple[str, ...], List[str], Set[str]]].

Location of problem:

https://github.com/dropbox/sqlalchemy-stubs/blob/55470ceab8149db983411d5c094c9fe16343c58b/sqlalchemy-stubs/sql/ddl.pyi#L36