Skip to main content
Version: v2.x

Hasura Data Connectors

Introduction

Hasura Data Connectors provide an easy way to build connectors to any data source and instantly obtain GraphQL APIs on that data.

Currently, Hasura natively supports Postgres, SQL Server, and BigQuery databases. Data Connectors allow you to connect Hasura to any other data source. Hasura has used Data Connectors to build connectors to MySQL, Oracle, Snowflake, Amazon Athena, MariaDB, MongoDB (coming soon), with more sources in the pipeline, but you can also use them to connect to your own. Think Microsoft Excel, SQLite, CSV, AirTable and more.

For more information on databases, check out the Hasura Databases documentation or to jump right into integrating a native database, check out the Quickstart.

This documentation will guide you through understanding Hasura Data Connectors concepts and how to use them.

Active Development

Data Connectors are currently in active development and are likely to change considerably. We are working hard to make them as stable as possible soon, but please be aware that breaking changes may occur.

Hasura GraphQL Data Connector Agent

The Hasura GraphQL Data Connector Agent is a service that acts as an intermediary middleware abstraction between a data source and the Hasura GraphQL Engine via a REST API. It allows users to implement Hasura's powerful GraphQL experience on any data source they use. Further information about the design and implementation of the Agent service can be found in the README.md of the Data Connector Agent repository.

Hasura GraphQL Data Connector Agent diagram

In addition, an agent can directly support new functionality without any other database upstream. The purpose of Data Connector agents is to quickly and easily allow developers to author new agents to support a wide variety of new data sources and use-cases.

Hasura GraphQL Data Connector SDK

The Data Connector SDK serves as a pack of documentation and resources for understanding, building, and testing Data Connector agent implementations to ensure that they are complete, correct, idiomatic and can be developed rapidly and with confidence. The workflow that the SDK supports out of the box is powered by Docker Compose in order to reduce the number of dependencies required, but each component may be run natively if desired. The SDK is versioned with the Hasura GraphQL Engine.

The SDK including the docker-compose.yaml file can be found here.

For more details on the SDK, check out the SDK repository README.md.

Building a New Data Connector with the SDK

To create a new Data Connector, follow these steps:

  1. Start the container with docker compose up.
  2. Verify that tests pass.
  3. Review & make changes to the reference connector for your specific database and intended implementation.
  4. Or rebuild as required, depending on your stack.
  5. Rerun the tests with docker compose run tests.
  6. Interact with the agent via Hasura GraphQL Engine at http://localhost:8080 and view the OpenAPI Schema at http://localhost:8300.

Reference Connector

The reference connector is located under the /reference path within the SDK and serves as a working connector example. It is written in TypeScript and has several key code snippet examples within the reference itself. For more information on the reference connector, check out README in the reference directory.