You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Help needed! sqlalchemy.exc.InvalidRequestError: When initializing mapper Mapper[User(user)], expression "relationship('list[RefreshToken]')" seems to be using a generic class
#1412
I am trying to make a user 1-t relation with refreshtokens. I have followed the example of SQLModel but when I start the app I get this error:
sqlalchemy.exc.InvalidRequestError: When initializing mapper Mapper[User(user)], expression "relationship('list[RefreshToken]')" seems to be using a generic class as the argument to relationship(); please state the generic argument using an annotation, e.g. "refresh_tokens: Mapped[list['RefreshToken']] = relationship()"
I have tried to add the Mapped, remove type_checking block, rebuild the model... None of them has worked.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
First Check
Commit to Help
Example Code
Description
I am trying to make a user 1-t relation with refreshtokens. I have followed the example of SQLModel but when I start the app I get this error:
sqlalchemy.exc.InvalidRequestError: When initializing mapper Mapper[User(user)], expression "relationship('list[RefreshToken]')" seems to be using a generic class as the argument to relationship(); please state the generic argument using an annotation, e.g. "refresh_tokens: Mapped[list['RefreshToken']] = relationship()"
I have tried to add the Mapped, remove type_checking block, rebuild the model... None of them has worked.
Operating System
Linux
Operating System Details
No response
SQLModel Version
0.0.24
Python Version
Python 3.13.5
Additional Context
No response
Beta Was this translation helpful? Give feedback.
All reactions