Introducing the Open-Source Hasura Data Dictionary
We’re excited to release the initial version of the Hasura Data Dictionary, an open-source project to make it easy to understand your data graph - which includes your database relationships, and GraphQL schemas.
It also helps you easily create complex GraphQL queries. Clone the code from this Github repo, which even includes a Docker compose file to get started in minutes on your local machine or infrastructure.
Gavin Ray, Technical Evangelist at Hasura, took me through how it works in this short video interview.
We created this project for three reasons:
- Help developers and teams quickly reference and understand the tables and relationships of the databases they work with, and the generated GraphQL schemas in their Hasura projects
- Quickly build complex GraphQL queries through an intuitive, easy to use interface
- Create a resource for the community to contribute, and use as a starting point to extend for their own specific needs, such as for content management.
Quickly Understand Entity & Schema Relationships
In the Data Dictionary, the Data Models gives you a view of the tables in your databases and also includes search capability.
Selecting a table will take you to the detail view, showing the table columns, field data types and indexes. You’ll also see the Query and Mutate GraphQL operations available to execute on that table - fetch, delete, insert, and update.
At the bottom of the Data Models view, you also get a visual entity-relationship view that illustrates the table relationships, making it easier to understand how the database is structured. The Data Graph view shows the entire macro view of all data relationships:
Build Complex GraphQL Queries
The GraphiQL tab makes it easy to experiment and create complex queries that would otherwise be difficult to do by hand. In the example below, we’ve constructed a GraphQL query that aggregates all the invoices for a specific customer and sums the total simply by checking the fields to report on and the available operations.
In this example we selected invoices_aggregate, and selected the sum of the total to generate our query - we didn’t need to memorize the exact GraphQL syntax to get it right.
Extend and Contribute
We hope you find the Data Dictionary useful and accelerates your development, or even embedded in your apps to help with configuration and administration. Contribute to the project if you think of any great features! There are two components to the Data Dictionary - the front end which we’ve shown you here, and a backend API that provides the metadata information.
Right now the Data Dictionary supports Postgres databases, but in the near future there will be support for MySQL and SQL Server.
Download the code in our Github repo to get started, which includes setup instructions and a Docker compose file to quickly get started!