Giter Site home page Giter Site logo

FastAPI Users/ormar integration about ormar HOT 4 CLOSED

collerek avatar collerek commented on May 17, 2024 1
FastAPI Users/ormar integration

from ormar.

Comments (4)

collerek avatar collerek commented on May 17, 2024

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.

paolodina avatar paolodina commented on May 17, 2024

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.

collerek avatar collerek commented on May 17, 2024

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.

collerek avatar collerek commented on May 17, 2024

@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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.