Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add mapped types in TYPE_CHECKING block for all cols #17

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jd-solanki
Copy link

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:
image

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 ❤️

@jd-solanki
Copy link
Author

I'm not expert here but I guess this also relates to UserProtocol in models.py

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.

1 participant