-
-
Notifications
You must be signed in to change notification settings - Fork 78
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
FastAPI Users/ormar integration #91
Comments
I looked quite some time ago into the fastapiusers and one trick point might be that it uses some template pydantic models to parse db models (at least that's what I remember, might have changed). The trick is that ormar models are pydantic models so maybe you can skip the whole parsing in users but didn't dig deeper so hard to tell if this is really possible. |
Ok, I got something. There is the FastAPI Users fork (branch, commit) and here a the demo anyone can try and report back in case of problems. Currently I tested only the I'd appreciate if you could have a look at the code on the fork (basically it's only one file containing the implementation), it's commented with some question/consideration. About this
I don't know if my code is OK but I didn't find any tricky part. |
Created a pull request paolodina/fastapi-users#1 with finished ormar db backend, with all power features of ormar used :) Please review this and let me know what you think. As for the "tricky" part my idea was that maybe you can skip parsing to dict and recreating fastapi-users models but i think its impossible if the database have to return the fu users. Run black and flake8 on the code but didn't run mypy, so it's also to be checked (if fastapi-users uses it). |
@paolodina the PR is merged! If you have other |
Reference: #84 (comment)
Yep, I'd be interested in doing that and thought to open this ticket to avoid that you or someone else also work on this at the same time.
I had a look at FastAPI Users code and I have to say that ormar/fastapi users integration shouldn't be too hard.
Basically they have the concept of "adapter", and the code for already implemented adapters is available here. Being able to provide the ormar adapter should do the trick, and for that I can take the Tortoise adapter as a starting point.
I hope to be able to finish the integration without issues and I'll keep this ticket updated when something will happen, in case of problems I accept your offer to help. I'll anyway refer to you @collerek for proofreading.
Thanks!
The text was updated successfully, but these errors were encountered: