Frequently Asked Questions

Getting Started & Implementation

How can I get started with Hygraph and set up a project?

You can get started with Hygraph by signing up for a free-forever account at app.hygraph.com. To create a project, set up a data model, and publish content, follow the Quickstart Guide. Hygraph is designed to be easy to use, even for non-technical users, and provides onboarding guides and documentation to help you launch quickly. For example, Top Villas launched a new project in just 2 months from initial contact. Learn more in the documentation.

How easy is it to start using Hygraph?

Hygraph is praised for its intuitive interface and ease of use. Customers report that it is 'super easy to set up and use,' and even non-technical users can start using it right away. The user interface is logical and user-friendly, making it accessible for both technical and non-technical teams. Read more customer feedback.

Features & Capabilities

What are the key features and capabilities of Hygraph?

Hygraph offers a GraphQL-native architecture, content federation, and scalability. Key features include rapid content delivery, optimized performance, and support for integrations with platforms like Netlify, Vercel, Shopify, BigCommerce, AWS S3, Cloudinary, and more. Hygraph also provides a powerful GraphQL API for efficient content management. See all features.

Does Hygraph support integrations with other platforms?

Yes, Hygraph supports a wide range of integrations, including hosting and deployment (Netlify, Vercel), eCommerce (BigCommerce, commercetools, Shopify), localization (Lokalise, Crowdin, EasyTranslate, Smartling), digital asset management (Aprimo, AWS S3, Bynder, Cloudinary, Mux, Scaleflex Filerobot), personalization and AB testing (Ninetailed), artificial intelligence (AltText.ai), and more. Explore all integrations.

Does Hygraph provide an API for content management?

Yes, Hygraph provides a powerful GraphQL API that allows you to fetch and manage content efficiently. The API supports querying, mutations, and subscriptions for real-time updates. Learn more in the API Reference.

What programming languages are supported for GraphQL servers?

GraphQL servers are available for multiple languages, including Haskell, JavaScript, Perl, Python, Ruby, Java, C++, C#, Scala, Go, Erlang, PHP, and R. This allows developers to build applications using their preferred language and leverage Hygraph's GraphQL API. Learn more about GraphQL.

How does Hygraph optimize content delivery performance?

Hygraph emphasizes optimized content delivery performance, which directly impacts user experience, engagement, and search engine rankings. By ensuring rapid content distribution and responsiveness, Hygraph reduces bounce rates and increases conversions. Learn more about performance optimization.

Pricing & Plans

What is Hygraph's pricing model?

Hygraph offers a free forever Hobby plan, a Growth plan starting at $199/month, and custom Enterprise plans. For more details and a breakdown of features included in each plan, visit the Hygraph pricing page.

Security & Compliance

What security and compliance certifications does Hygraph have?

Hygraph is SOC 2 Type 2 compliant, ISO 27001 certified, and GDPR compliant. These certifications ensure enterprise-grade security and data protection for users. Hygraph also provides features like SSO integrations, audit logs, encryption at rest and in transit, and sandbox environments. Learn more about Hygraph security features.

Use Cases & Benefits

Who can benefit from using Hygraph?

Hygraph is ideal for developers, IT decision-makers, content creators, project/program managers, agencies, solution partners, and technology partners. Companies that benefit most include modern software companies, enterprises looking to modernize their technologies, and brands aiming to scale across geographies, improve development velocity, or re-platform from traditional solutions. See case studies by industry.

What business impact can customers expect from using Hygraph?

Customers can expect significant business impacts, including time-saving through streamlined workflows, ease of use with an intuitive interface, faster speed-to-market for digital products, and enhanced customer experience through consistent and scalable content delivery. These benefits help businesses modernize their tech stack and achieve operational efficiency. Learn more about business impact.

What industries are represented in Hygraph's case studies?

Hygraph's case studies span industries such as food and beverage (Dr. Oetker), consumer electronics (Samsung), automotive (AutoWeb), healthcare (Vision Healthcare), travel and hospitality (HolidayCheck), media and publishing, eCommerce, SaaS (Bellhop), marketplace, education technology, and wellness and fitness. Explore case studies.

Can you share specific customer success stories using Hygraph?

Yes, Hygraph has several notable success stories. Komax achieved a 3X faster time to market, Autoweb saw a 20% increase in website monetization, Samsung improved customer engagement with a scalable platform, and Dr. Oetker enhanced their digital experience using MACH architecture. Read more customer stories.

Pain Points & Solutions

What problems does Hygraph solve?

Hygraph addresses operational pains (reliance on developers for content updates, outdated tech stacks, conflicting needs from global teams, clunky user experiences), financial pains (high operational costs, slow speed-to-market, expensive maintenance, scalability challenges), and technical pains (boilerplate code, overwhelming queries, evolving schemas, cache problems, OpenID integration challenges). Learn more about solved pain points.

How does Hygraph solve pain points for different personas?

Hygraph tailors solutions for different personas: Developers benefit from reduced boilerplate code and streamlined query management; content creators and project managers gain independence from developers and a user-friendly interface; business stakeholders see lower operational costs, easier scalability, and faster speed-to-market. See persona-specific solutions.

What KPIs and metrics are associated with the pain points Hygraph solves?

Key metrics include time saved on content updates, number of updates made without developer intervention, system uptime, speed of deployment, consistency in content across regions, user satisfaction scores, reduction in operational costs, ROI on CMS investment, time to market for new products, maintenance costs, scalability metrics, and performance during peak usage. Read more about CMS KPIs.

Technical Documentation & Support

Where can I find Hygraph's technical documentation?

Hygraph offers comprehensive technical documentation covering everything you need to know about building and deploying projects. Access it at hygraph.com/docs.

What customer service or support is available after purchasing Hygraph?

Hygraph provides 24/7 support via chat, email, and phone. Enterprise customers receive dedicated onboarding and expert guidance. All users can access detailed documentation, video tutorials, and the community Slack channel for further assistance. Contact Hygraph support.

What training and technical support is available to help customers get started?

Hygraph offers onboarding sessions for enterprise customers, 24/7 support via chat, email, and phone, training resources such as video tutorials, documentation, webinars, and access to Customer Success Managers for expert guidance. Learn more about support.

Product Information & GraphQL

What is GraphQL and how does Hygraph utilize it?

GraphQL is an open-source data query and manipulation language for APIs, developed by Facebook in 2012 and released publicly in 2015. It allows clients to request exactly the data they need, avoiding over- or under-fetching. Hygraph leverages GraphQL to provide a GraphQL Playground for efficient data management and integration. Learn more about GraphQL.

How can I use GraphQL with Python and Hygraph?

You can query GraphQL endpoints with Python and build applications such as a To-Do List app using Flask. Hygraph supports making GraphQL requests using libraries like requests, gql, and graphqlclient. For a step-by-step guide, see the blog post How to Use GraphQL with Python.

What are the advantages of using GraphQL over REST APIs?

GraphQL solves three major issues found in REST APIs: overfetching (fetching too much data), underfetching (requiring multiple requests for related data), and inflexibility (needing new endpoints for changes). With GraphQL, you fetch only the fields you need, can request nested data in a single query, and use a single endpoint for all data operations, improving performance and developer productivity. Learn more about GraphQL vs REST.

Customer Proof & Case Studies

Who are some of Hygraph's customers?

Hygraph is trusted by leading brands such as Sennheiser, HolidayCheck, Ancestry, Samsung, Dr. Oetker, Epic Games, Bandai Namco, Gamescom, Leo Vegas, and Clayton Homes. See more customer stories.

Webinar Event: How to Avoid Personalization Tech Traps

How to Use GraphQL with Python

Let's take a look at how you can query GraphQL endpoints with Python and build a demo To Do List app in Flask.
Aagam Vadecha

Last updated by Aagam 

Oct 21, 2024

Originally written by EzzEddin

How to Use GraphQL with Python

Increasing amounts of data are being consumed and generated today. Clients, on one side, need to load data as fast as they can. Developers, on the other side, need to make their apps performant. If your app is fast, your clients will have a better user experience and will be happy, and eventually, your business will make more money.

Modern apps should be faster than the old ones. Your app should get data fast from the server to the client. GraphQL is a sure solution for that.

#Why use GraphQL

Back in 2012, Facebook engineers found that iOS and Android apps frequently crashed. They decided to look at how to improve how Facebook data was being sent to the client apps. Then they built GraphQL for their internal use. In September 2015, Facebook released GraphQL to the public.

In 2000, a Ph.D. dissertation defined REST as a resource-oriented architecture with operations like GET, PUT, POST, and DELETE. Regarding the data model, REST API architecture is much simpler than RPC and SOAP. Countless apps have used REST APIs, however, they have shortcomings, making GraphQL a superior option.

Three major issues REST has:

  • Over fetching

    In the REST world, you get too much data in the response you don't need. This problem is called overfetching. In GraphQL, you're fetching only the fields you want. This makes GraphQL more declarative and faster.

  • Under fetching

    In REST, if you developed an endpoint that returns specific data and there is a feature request to fetch more data from the response, you would need additional requests to get these new data. This is how you underfetched. In GraphQL, you must add new key(s) to the nested query. This will request the data all in just one fetch.

  • Inflexibility

    Another pain of REST APIs is the inflexibility, especially if your app is getting bigger. In REST, when a client needs a change in your app, you will probably create a new endpoint. These endpoints keep adding up whenever there is a need. Thus, more collaboration between your backend and frontend teams. This will cost time and speed, as new endpoints mean more HTTP requests from the clients. In GraphQL, a single endpoint is typically involved. This makes easy organization of data easy and more productivity among your teams.

#Building a simple GraphQL wrapper using Flask

In this post, we will build a simple GraphQL wrapper on top of Hygraph. You'll be able to use the Hygraph GraphQL Query API. We will learn how to authenticate with the Hygraph API using Python, fetch data from the Hygraph server, and wrap the result in a Flask app.

Creating a Hygraph project

Sign up on Hygraph, and please follow this quickstart guide, to create a project, set up a data model, and publish some content to it.

Setting up the Python Flask app

Let us open the terminal and set up a quick virtual environment using the commands below

python -m venv venv
# Linux
source venv/bin/activate
# Windows
venv\Scripts\activate
pip install --upgrade pip

We will see three ways to make GraphQL requests with Python:

Let us install dependencies, all required dependencies for our project with pip:

pip install flask requests gql graphqlclient

Create a directory structure as shown below

flask_app/
├── app/
│ ├── __init__.py
│ ├── routes.py
│ └── services.py
├── run.py
├── requirements.txt
└── venv/

Add the following code to the respective files

run.py

from app import create_app
app = create_app()
if __name__ == '__main__':
app.run()

app/__init__.py

from flask import Flask
def create_app():
app = Flask(__name__)
# Import routes
from .routes import main_routes
app.register_blueprint(main_routes)
return app

app/routes.py

from flask import Blueprint, jsonify
from .services import fetch_data_with_requests, fetch_data_with_gql
main_routes = Blueprint('main', __name__)
@main_routes.route('/get_data_1', methods=['GET'])
def get_data_1():
data = fetch_data_with_requests()
return jsonify(data)
@main_routes.route('/get_data_2', methods=['GET'])
def get_data_2():
data = fetch_data_with_gql()
return jsonify(data)
@main_routes.route('/get_data_3', methods=['GET'])
def get_data_3():
data = fetch_data_with_graphqlclient()
return jsonify(data)

So far, we have created a very basic Flask application and defined three routes: get_data_1 and get_data_2, and get_data_3. These three routes will use the service file to get data from our Hygraph API using different packages and return it to the client. The get_data_1 route is supposed to use the requests package, while the get_data_2 will use a more structured gql package to make GraphQL requests, and the get_data_3 route will use the graphqlclient to make GraphQL requests.

Making GraphQL requests from Python

Let us create our service file and import some fundamental requirements there.

app/services.py

import requests
from gql import gql, Client
from gql.transport.aiohttp import AIOHTTPTransport
from graphqlclient import GraphQLClient
import json
URL = "add_your_hygraph_url_here"
TOKEN = "add_your_hygraph_token_here"
QUERY = '''
query getUsers {
products {
name
price
image {
url
fileName
}
}
}
'''

We have imported the packages that we will require, defined the GraphQL query that we need to make on the GraphQL server, and declared two variables around our hygraph URL and TOKEN, do replace them with your own Hygraph URL and TOKEN.

Requests

Let us make a GraphQL query using the requests package. requests is a general package that can be used to make any HTTP/S requests. For this use case, we need to define headers by providing an authentication bearer token and send a POST request to the Hygraph server with the query and headers.

import requests
def fetch_data_with_requests():
headers = {"Authorization": f"Bearer {TOKEN}"}
response = requests.post(URL, json={'query': QUERY}, headers=headers)
return response.json()

GraphQL

On the other hand, gql is more of a GraphQL-specific client package and is one of the top GraphQL Client libraries available for Python. We need to set up a transport and a client variable as shown below.

transport = AIOHTTPTransport(url=URL, headers={"Authorization": f"Bearer {TOKEN}"})
client = Client(transport=transport, fetch_schema_from_transport=True)

Then we can wrap our GraphQL operation using the gql tag and execute the query.

query = gql(QUERY)
result = client.execute(query)

The final code for making a GraphQL request with gql will look like this

from gql import gql, Client
from gql.transport.aiohttp import AIOHTTPTransport
def fetch_data_with_gql():
transport = AIOHTTPTransport(url=URL, headers={"Authorization": f"Bearer {TOKEN}"})
client = Client(transport=transport, fetch_schema_from_transport=True)
query = gql(QUERY)
result = client.execute(query)
return result

Also, in a proper production app, we only need to define the transport and client once when a class initializes, later we can use the same class instance and execute GraphQL operations from anywhere in our application without worrying about connection details.

GraphQLClient

For graphqlclient, we need to create a client using the GraphQLClient provided by the library, we can add the Hygraph token using the inject_token function on the client and pass it the token, finally, we will need to convert the string response to parsable JSON using json.loads and that’s it.

from graphqlclient import GraphQLClient
import json
def fetch_data_with_graphqlclient():
client = GraphQLClient(URL)
client.inject_token(TOKEN)
result = json.loads(client.execute(QUERY))
return result

Below is the final service file

app/services.py

import requests
from gql import gql, Client
from gql.transport.aiohttp import AIOHTTPTransport
from graphqlclient import GraphQLClient
import json
URL = "add_your_hygraph_url_here"
TOKEN = "add_your_hygraph_token_here"
QUERY = '''
query getUsers {
products {
name
price
image {
url
fileName
}
}
}
def fetch_data_with_requests():
headers = {"Authorization": f"Bearer {TOKEN}"}
response = requests.post(URL, json={'query': QUERY}, headers=headers)
return response.json()
def fetch_data_with_gql():
transport = AIOHTTPTransport(url=URL, headers={"Authorization": f"Bearer {TOKEN}"})
client = Client(transport=transport, fetch_schema_from_transport=True)
query = gql(QUERY)
result = client.execute(query)
return result
def fetch_data_with_graphqlclient():
client = GraphQLClient(URL)
client.inject_token(TOKEN)
result = json.loads(client.execute(QUERY))
return result

#Conclusion

In this article, we went through the problems that GraphQL solves over REST. Through the quickstart, we created data models and published some content in Hygraph and finally, we built a flask wrapper app in Python to query our content via three libraries - requests, gql, and graphqlclient.

Blog Authors

Share with others

Sign up for our newsletter!

Be the first to know about releases and industry news and insights.