Show HN: Graphene – GraphQL framework for Python
graphene-python.org
graphene-python.org
Please guys, give us an explanation on the front page of what the hell it is (in a meaningful non-generic way) and why we would want to use it.
As a side note, a better approach for handling errors is coming to graphene soon
Can you see how dataloader might be implemented? The JavaScript version uses magic involving process ticks to aggregate promises within a single run loop, and batch them into a single operation. My knowledge of async in Python isn't deep enough to know whether something similar is possible.
As far as how a data-loader is implemented, I have a few experiments doing it with gevent, but nothing prod ready. Essentially you can just use the `loop.run_callback` function to get the "next tick" semantics. I combined this along with gevent's AsyncResult to provide a pythonic coroutine based implementation of FB's datawrapper.
[1] https://github.com/graphql-python/graphql-core
[2] https://github.com/graphql-python/graphql-core/tree/master/graphql/core/execution/middlewaresI understand it's a caching problem which is hard (I know that joke), but I'm wondering specifically how it's handled with a graph query.
The way I've been doing it is using a SQL structured on the front-end and downloading the main table/rows + changes. But graphql seems to be downloading and aggressively caching without keeping track of timestamp.
Sometimes the types could be defined after the class definition. In this case, you can use strings for reference field types. Something like:
class User(graphene.ObjectType): friends = graphene.Field('self') # 'User' would work too.
class User(graphene.ObjectType):
name = graphene.String()
initials = graphene.String()
def resolve_name(self, args, info):
return user_service.lookup_name(...)
def resolve_initials(self, args, info):
# How can I refer to the result of resolve_name above?
return ''.join(part for part in name.split(' '))
Perhaps I'm not using graphene in the way it was intended to be used?