sqlalchemy-stubs icon indicating copy to clipboard operation
sqlalchemy-stubs copied to clipboard

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

Open jace opened this issue 3 years ago • 0 comments

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

jace avatar Oct 21 '20 19:10 jace