fastapi-users-db-sqlalchemy
fastapi-users-db-sqlalchemy copied to clipboard
fix: add mapped types in TYPE_CHECKING block for all cols
Hi @frankie567 👋🏻
I've been playing with fastapi-users and I have to remove unique constaint on email col due to soft deletes. Hence, I added my own email col however as I've email col like this:
email: Mapped[str] = mapped_column(
String(length=320),
index=True,
nullable=False,
kw_only=True,
)
'm getting error from pylance `Override type "Mapped[str]" is not the same as base type:
Hence, I added unique of Mapped as well.
However, I can't understand why we need seperate if TYPE_CHECKING:? If we directly write cols like normal table it should work. If removing if TYPE_CHECKING: we can reject this PR as problem should solve automatically as now type will be same.
Big Thanks for this lib ❤️
I'm not expert here but I guess this also relates to UserProtocol in models.py