-
Notifications
You must be signed in to change notification settings - Fork 129
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
SQLModel Compatibility #271
Comments
Any updates on this? :) |
Update? I think it's a feature request. |
Yep, the it sounds like a feature request yet totally out of |
Hey, someone has a solution for this? |
I wish to also register my interest in the provisioning of this compatability. |
I am also interested. |
Can't wait to be compatible. I really need this feature. |
I found a solution. I'm currently using:
Before declaring any model, do the following:
This should work with SQLModels. Your models should inherit from BaseSQLModel. If you use SQL Server as your database, you may encounter an error due to a sequence definition in the id column of the TransactionClass. You can rewrite the TransactionClass as shown below to address this issue. Additionally, I use a FastAPIPlugin to retrieve the user from the session. All you need to do is set the user data in the session.info dictionary. Here is the complete code I use:
|
SQLModel (https://github.com/tiangolo/sqlmodel) is notionally built as a layer on top of SQLAlchemy, so it would be awesome to use SQLAlchemy Continuum to version SQLModel managed databases. However, the basic getting started example throws an error when replacing the SQLAlchemy model with a SQLModel version. I'm not entirely clear on how SQLModel inherits from SQLAlchemy and to what degree compatibility is possible, but if there's some trivial fix to bubble up the missing attributes it would be fantastic.
Tutorial Example, but using SQL Model
Error Output
The text was updated successfully, but these errors were encountered: