Tutorial: Get instant GraphQL APIs on BigQuery with Hasura
Introduction
We recently launched BigQuery support for Hasura (to get a full list of supported databases, look here.
In this guide, we’ll show how to connect BigQuery to Hasura Cloud, set default limits, and run a few queries.
This guide will follow in two parts, feel free to skip to the part that is more interesting for you.
- Part I: Connecting BigQuery (you are here)
- Part II: Building a Dashboard with BigQuery, Optimizing Performance
To get started with Hasura on BigQuery you can head straight to the documentation:“Getting started with BigQuery”.
BigQuery with Hasura
BigQuery provides a rich ecosystem of utilities and services for wide-column datasets that have made it a market leader in use-cases that need to track many points of detail with high-transaction counts.
Hasura excels in the space between BigQuery and the front-end architects. Hasura makes really fast, dynamic, APIs, provides descriptive access controls, and if you are using Hasura Cloud, enables automatic rate limiting, caching query depth controls, and more.
Combining Hasura with BigQuery provides a fast and descriptive API for BigQuery that can be meshed with the rest of your data-layer, opening up a wider set of use-cases for the massive amounts of data that BigQuery typically stores.
Features of note are:
- Dynamic GraphQL APIs that are generated based on the model in your database.
- Fine-grained authorization controls that ensure appropriate data ownership practices.
- An @cache directive for annotating queries out of BigQuery for instant cache.
- Setting API rate limits and query depth limits to ensure efficient and affordable database utilization.
- Allow-lists that let you observe your actual query usage, and save those to an approved list, preventing unintended use of the application.
Utilizing these features you free up your developers to explore the dataset and surface new and creative ways to work with data you have while still maintaining good data hygiene, ownership hierarchy, and privacy best practices. Write less proxy code and more domain code by integrating BigQuery with Hasura.
Early users of the BigQuery integration have used Hasura to build instant, dynamic APIs on top of BigQuery as well as speed up application development timelines. With Hasura, frontend developers on the team are able to do the work of data engineers thereby decreasing the overall time to market.
Connecting the APIs
In this first video, we’ll walk through connecting BigQuery to Hasura, tracking tables, defining custom relations and setting reasonable security defaults. In the followup video, we’ll look at accessing that content from a front-end application.
Closing
In the next video, we'll cover adding permission controls and query optimizations as we load the data into a front-end application.