Skip to main content

Federation implementation for graphene

Project description


Federation support for graphene

Build: CircleCI

Draft version, of federation specs implementation on top of Python graphene lib

Use at your own risk

Based on discussion:

Supports now:

  • sdl (_service fields) # make possible to add schema in federation (as is)
  • @key decorator (entity support) # to perform Queries across service boundaries
  • extend # extend remote types
  • external # mark field as external

Todo implement:

  • @requires
  • @provides
import graphene
from graphene_federation import build_schema, key

@key(fields='id')  # mark File as Entity and add in EntityUnion
class File(graphene.ObjectType):
    id = graphene.Int(required=True)
    name = graphene.String()

    def resolve_id(self, info, **kwargs):
        return 1

    def resolve_name(self, info, **kwargs):

    def __resolve_reference(self, info, **kwargs):  #
        return get_file_by_id(
import graphene
from graphene_federation import build_schema

class Query(graphene.ObjectType):

schema = build_schema(Query)  # add _service{sdl} field in Query
import graphene
from graphene_federation import external, extend

class Message(graphene.ObjectType):
    id = external(graphene.Int(required=True))

    def resolve_id(self, **kwargs):
        return 1

For more details see examples

Or better check integration_tests

Also cool example of integration with Mongoengine

For contribution:

Run tests:

  • make test
  • if you've changed Dockerfile or requirements run make build before make test

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for graphene-federation, version 0.0.3
Filename, size File type Python version Upload date Hashes
Filename, size graphene-federation-0.0.3.tar.gz (4.5 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page