Comments (4)
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.
from ormar.
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 /auth
and /users
endpoints, they seem working so far. I still have to test other endpoints and implement the oauth user case. I have some mypy errors in vscode too.
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
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.
I don't know if my code is OK but I didn't find any tricky part.
from ormar.
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.
In my opinion what is left is more tests and documentation update but again didn't dig deep into fastapi-users and never used it.
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).
from ormar.
@paolodina the PR is merged!
Good job and thanks ;)
If you have other fastapi
ecosystem libraries that you would like ormar
to support let me know, we can work this out ;)
from ormar.
Related Issues (20)
- `values_list` querying and returning wrong flattened data
- How to get a list of rooms and users who are in that room by user id HOT 1
- Getting `KeyError` when using `.exclude` in a `QuerySetProxy`
- Migrate to Pydantic V2 HOT 14
- use snake case for table names in the database
- Multiple reverse relations not working.
- Add `first_or_none`
- FastpAPI state has not database HOT 4
- How to configure alembic autogenerate with multiple model files HOT 5
- Error awaiting None
- Upgrade to SQLAlchemy 2.0 HOT 5
- Add SELECT DISTINCT feature to queryset
- Failing test: test_weakref_init
- Reverse relation not returned from get_pydantic
- Low performance on select_all() call HOT 1
- Nullable ForeignKey field does not get updated to null
- The future of ORMAR HOT 6
- Support specifying a table comment
- Please support pydantic-2.x HOT 3
- New release with the latest dependency upgrades HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ormar.