Playing With GraphQL + Python Flask

Written by rahulmfg | Published 2017/07/16
Tech Story Tags: graphql | flask | sqlalchemy

TLDRvia the TL;DR App

A good friend😉 suggested me to learn GraphQL and just when I was looking for resources, HOW TO GRAPHQL was launched.

I went with fundamentals of GraphQL in it and found Graphene later. It’s a GraphQL framework for Python. I was more interested in Graphene-SQLAlchemy.

So I learned those stuff as well and came out with a simple project for using GraphQL with Python-Flask using Graphene-SQLAlchemy.

In the demo project I created a simple table “users” with field id, name, email, username. And, created a schema(schema.py) to

  • Add a new user.
  • Get all users list.
  • Find a user with username.
  • Update username with email ID.

Below are the example screenshots of GraphQL query execution:

Query to find a user

Mutation to change username

You can try the demo project here. Looking forward to use React with the demo project stack. And do let me know if you find any typo or bugs. 👨‍💻 🙌


Published by HackerNoon on 2017/07/16