sqlalchemy-stubs
sqlalchemy-stubs copied to clipboard
Bug when field is named `id`
I maintain a "realworld example app" for Pyramid, a popular Python Web framework. The example app uses SQLAlchemy. Recently I added sqlalchemy-stubs to the project to showcase how to do typing for SQLAlchemy models. And I've hit a bug:
When I define an id field in my model like so:
id = Column(Integer)
then I get the following error:
src/conduit/comment/models.py:48: error: Argument 1 to "Column" has incompatible type "Type[Integer]"; expected "Type[TypeEngine[str]]"
However, If I change the line to:
id_ = Column(Integer)
or
foo = Column(Integer)
then mypy says everything is good. Is this a bug or am I doing something wrong?