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

Update fastapi-users v12 #329

Merged
merged 4 commits into from
Jul 11, 2023

Conversation

davidbrochart
Copy link
Collaborator

No description provided.

@davidbrochart
Copy link
Collaborator Author

Type check fails with:

plugins/auth/fps_auth/db.py:33: error: Incompatible types in assignment (expression has type "Column[str]", base class "SQLAlchemyBaseUserTable" defined the type as "str")  [assignment]

It's pointing to this line where email is defined:

class User(SQLAlchemyBaseUserTableUUID, Base):
    anonymous = Column(Boolean, default=True, nullable=False)
    email = Column(String(length=32), nullable=False, unique=True)
   ...

It seems to be an SQLAlchemy issue, but maybe @frankie567 has an idea?

@frankie567
Copy link
Contributor

Why do you need to redefine the email column? It's directly provided by SQLAlchemyBaseUserTableUUID (besides 32 characters is probably too short). That's why there is a type mismatch between the two.

@davidbrochart
Copy link
Collaborator Author

Ah right, it was not necessary. Thanks!

@davidbrochart
Copy link
Collaborator Author

@frankie567 I had weird errors when accessing User.oauth_accounts, defined here:

sqlalchemy.exc.MissingGreenlet: greenlet_spawn has not been called; can't call await_only() here. Was IO attempted in an unexpected place? (Background on this error at: https://sqlalche.me/e/20/xd2s)

It was caused by a MissingGreenlet. After making the recommended changes in 9fced2b it works fine.
Do you think it's the right thing?

@davidbrochart davidbrochart merged commit 8108945 into jupyter-server:main Jul 11, 2023
@davidbrochart davidbrochart deleted the fastapi-users-v12 branch July 11, 2023 21:12
@frankie567
Copy link
Contributor

Well, TIL about AsyncAttrs. Looks nice!

However, if you have lazy="joined" on the relationship arguments, oauth accounts should be loaded eagerly up-front, so you shouldn't have this error 🤔

@davidbrochart
Copy link
Collaborator Author

Mmm then I'm not sure what was going on, I might have to revisit this issue in the future.

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.

2 participants