ormar icon indicating copy to clipboard operation
ormar copied to clipboard

Investigate /add graphql support

Open collerek opened this issue 3 years ago • 4 comments

Probably with https://github.com/tartiflette/tartiflette

As separate package?

collerek avatar Apr 21 '21 07:04 collerek

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

collerek avatar Jun 09 '21 11:06 collerek

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!

jeasoft avatar Jun 27 '21 08:06 jeasoft

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.

collerek avatar Jun 27 '21 09:06 collerek

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

nicholasbutlin avatar Jan 30 '22 15:01 nicholasbutlin