Building a supergraph with Snowflake and PostgreSQL using Hasura

Using Snowflake DB and Neon PostgreSQL

In today's fast-paced world, building scalable and efficient backends for applications is essential. Developers are constantly searching for tools that can simplify the process and improve performance.

Hasura Cloud, Snowflake DB, and PostgreSQL on Neon offer a powerful combination to create a supergraph backend that handles complex data requirements, like joining data across multiple data sources, filtering data on model relations. It's a supergraph architecture with a unified layer, made from modules, continuously evolving which is present in many different companies across the globe.

In this blog post, we'll guide you through the process of building such a backend, highlighting the use of Snowflake and PostgresSQL databases, as well as demonstrating individually executed and nested queries.

In this tutorial/guide, we'll guide you through the process of building such a backend, highlighting the adding of Snowflake tables and PostgresSQL tables as models to the supergraphs, as well as demonstrating complex queries with nesting that can relate models from across different data sources.

1. Setting up Hasura Cloud
Hasura Cloud is a fantastic tool for creating GraphQL APIs quickly. This is a preliminary tutorial to get started, a more detailed guide will be coming up soon.

Here, we will see how to:

  • Sign up for a Hasura Cloud account.
  • Create a new project and connect it to your version control system (e.g., GitHub).
  • Define your data model using Hasura's metadata.
  • Run some exciting queries

2. Integrating Snowflake DB
Snowflake is a cloud-based data warehousing platform that seamlessly integrates with Hasura Cloud. To integrate Snowflake:

  • Obtain your Snowflake credentials (account, username, password).
  • In Hasura Cloud, navigate to the "Data" tab and add a new data source.
  • Select "Snowflake" and input your credentials.
  • “Import all tables” to add all the tables as models to the supergraph

3. Incorporating PostgreSQL on Neon
Neon is a managed platform for PostgreSQL databases. To incorporate PostgreSQL on Neon into your supergraph backend:

  • Sign up for Neon and create a new PostgreSQL database instance.
  • Obtain the connection details for your Neon PostgreSQL database.
  • In Hasura Cloud, add another data source, but this time, select "Neon Database" and authorize the Neon database connection details.
  • Add the models and relationships you want to track in the data tab.

4. Executing individual queries
Now that you have Snowflake and PostgreSQL on Neon integrated into your Hasura Cloud project, you can execute queries individually.

Querying Snowflake
To query data from Snowflake, you can use Hasura's GraphQL API:

query MyQuery {

Replace snowflakeTable, column1, and column2 with your Snowflake table and columns.

Querying PostgreSQL on Neon
Similarly, to query data from your Neon PostgreSQL database:

query MyQuery {
  neontable {

Replace neonTable, column1, and column2 with your Neon table and columns.

5. Nested queries for complex data retrieval
One of the advantages of GraphQL is its ability to handle complex data retrieval through nested queries. Let's demonstrate this with an example:

query {
  getUser(userId: 123) {
    posts {

In this query:

  • We retrieve user details by their ID from either Snowflake or PostgreSQL.
  • Then, we fetch the user's posts with their titles and content.

By defining appropriate relationships and foreign keys in Hasura's metadata for both Snowflake and PostgreSQL, you can seamlessly perform nested queries like the one above, aggregating data from multiple sources into a single response.


Building a supergraph backend using Hasura Cloud, Snowflake DB, and PostgreSQL on Neon offers incredible flexibility and performance. You can efficiently integrate multiple data sources and execute both individual and nested queries, making it suitable for a wide range of applications.

Explore the power of these tools and start creating your supergraph backend today for a seamless and efficient data-driven application experience.

Sign up now for Hasura Cloud to get started!

12 Oct, 2023
Subscribe to stay up-to-date on all things Hasura. One newsletter, once a month.
Accelerate development and data access with radically reduced complexity.