dropbox / dropbox/sqlalchemy-stubs

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

Open
#181 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
Python
Stars
583
Forks
96
PR merge metrics
No merged PRs in 30d

Description

mypy raised an error on this code:

```python
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](https://docs.sqlalchemy.org/en/13/core/ddl.html#sqlalchemy.schema.DDLElement.execute_if) and [source code](https://github.com/zzzeek/sqlalchemy/blob/c3f102c9fe9811fd5286628cc6aafa5fbc324621/lib/sqlalchemy/sql/ddl.py#L215-L225) 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

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.