PyCon.de: graphql in the python world - Nafiul IslamΒΆ

Tags: pycon, python

(One of my summaries of a talk at the 2017 PyCon.de conference).

graphql is a query language for your API. You don’t call the regular REST API and get the standard responses back, but you ask for exactly what you need. You only get the attributes you need.

Graphiql is a graphical explorer for graphql. Github is actually using graphql for its v4 API. He did a demo.

The real question to ask: why graphql over REST?

  • There is a standard. No more fights over the right way to do REST.
  • Development environment (graphiql).
  • You get only what you want/need.
  • Types.

Lots of companies are using it already.

What does python have to offer? graphene. Graphene uses these concepts:

  • Types/objects. More or less serializers.
  • Schema. Collection of objects and mutations. “Your API”.
  • Resolver.
  • Query. What you can ask of the API. “You can search for users by username and by email”.
  • Mutations. Changes you allow to be made. “You can create a new user and you have to pass a username and email”.

He demoed it. It looked really comfortable and slick.

Some small things:

  • 2.0 is out (today!).
  • The django integration is better than the sqlalchemy integration at the moment.
  • There’s middleware for authentication.
  • Join in!
https://abload.de/img/screenshot2017-10-12a0tubc.png

Photo explanation: some 1:87 scale figures on my model railway (under construction).

blog comments powered by Disqus
 
vanrees.org logo

About me

My name is Reinout van Rees and I work a lot with Python (programming language) and Django (website framework). I live in The Netherlands and I'm happily married to Annie van Rees-Kooiman.

Weblog feeds

Most of my website content is in my weblog. You can keep up to date by subscribing to the automatic feeds (for instance with Google reader):