Skip to main content
Version: v2.x

Data Federation

Introduction

Hasura’s data federation capabilities allow you to compose data from different sources that reside in independent data stores but are semantically related. This is done by creating a single GraphQL schema from multiple data sources thereby making the data access process self-serve, allowing you to query, mutate or federate real-time and stream data across services without writing any custom code.

The remote data sources can either be a table from a database source, a GraphQL API added as a remote schema, or a REST API added as an action. Once you create relationships between types from your database tables, remote schemas and actions, you can then "join" data across them by running GraphQL queries.

Types of remote relationships

Hasura GraphQL engine supports the following relationships across your various data sources:

  • Database to database relationships: To join data across tables between two different database sources, such as order information stored in a Postgres database, and user information stored in a separate Postgres or say a SQL Server database.
  • Database to Remote Schema relationships: To join data across tables and remote GraphQL APIs. For example, you can join customer data from your tables with account data from Stripe, Spotify, or Auth0 via their GraphQL APIs.
  • Remote Schema to database relationships: To join data from remote GraphQL schemas to database tables. For example connecting account data from Stripe, Spotify or Auth0 GraphQL APIs to customer data in your tables.
  • Remote Schema to Remote Schema relationships (a.k.a GraphQL joins): To join data between two remote GraphQL schemas. For example connecting customer data from your custom GraphQL API to account data from Stripe, Spotify or Auth0 GraphQL APIs.
  • Action to database relationships: To join data across tables and actions (i.e. Rest APIs). For example, you can join user data from your database with the response from a createUser action.