Skip to content

Fix typing on SQLAlchemy where clause#28

Open
dokson wants to merge 1 commit into
fastapi-users:mainfrom
dokson:fix/issue-19-mapped-typing
Open

Fix typing on SQLAlchemy where clause#28
dokson wants to merge 1 commit into
fastapi-users:mainfrom
dokson:fix/issue-19-mapped-typing

Conversation

@dokson
Copy link
Copy Markdown

@dokson dokson commented Jun 6, 2026

Drop the TYPE_CHECKING/else hack and keep the Mapped[...] columns so type checkers (Pylance/mypy) infer InstrumentedAttribute instead of plain str/bool. User.email == "x" now yields ColumnElement[bool], valid in .where(). Removed the # type: ignore comments that are no longer needed.

Runtime unchanged (the else branch always ran). Tests pass at 100% coverage; mypy and pyright clean.

Fixes #19

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Hack on typing returns typing error on sqlalchemy where clause

1 participant