ormar
ormar copied to clipboard
Investigate /add graphql support
Probably with https://github.com/tartiflette/tartiflette
As separate package?
Looking at starlette docs it seems that graphene can also run async: https://www.starlette.io/graphql/
There is also: https://github.com/mirumee/ariadne https://github.com/strawberry-graphql/strawberry
and (most basic but more pythonic?) https://github.com/ethe/pygraphy
In my humble opinion, the ORM doesn't have to have support for GraphQL, at least that you want to convert this (or use it as part) in a project like sandman2, which is a great tool to expose a DB with a RestAPI. BTW, great job with orman, i'm exploring it right now, and seems great!
Yeah it's more like a separate package that will ease the graphql queries construction. Not a part of the core.
I have some outstanding tasks like changing the type hints system as primitive python types for fields are not working well with auto completion and mypy.
So this one has relatively low priority. In theory it should work with graphene-pydantic, yet i didn't test this.
I have been using https://github.com/strawberry-graphql/strawberry
It works perfectly well with the strawberry / pydantic autocomplete, where Department is an Omar model:
@strawberry.experimental.pydantic.type(model= Department)
class DepartmentType:
id: strawberry.auto
name: strawberry.auto
although it is a little longwinded to have to define each field you want in the type (although that is kind of consistent with the graphql ethos...)