Connecting Hasura to an EnterpriseDB (BigAnimal) Postgres Database
Introduction
This guide explains how to connect a new or existing EnterpriseDB (BigAnimal) Postgres database to a Hasura instance, either on Hasura Cloud or self-hosted. If you're exploring EnterpriseDB Postgres and are interested in migrating an existing Postgres database - such as from Heroku - check out their docs before continuing below.
If you plan on using Hasura Cloud, which we recommend, follow steps 1 and 2 below. If you're self-hosting a Hasura instance and already have a project running, skip to step 3.
Step 1: Sign up or log in to Hasura Cloud
Navigate to Hasura Cloud and sign up or log in.
Step 2: Create a Hasura Cloud project
On the Hasura Cloud dashboard, create a new project:
After the project is initialized successfully, click on Launch Console
to open the Hasura Console in your browser.
On the Hasura Console, navigate to the Data
tab and choose Connect Existing Database
. Hasura will prompt you for a
Postgres Database URL. We'll create this in the next step and then come back here.
Step 3: Create a BigAnimal Postgres DB on EnterpriseDB
Log into EnterpriseDB and head to your dashboard.
From your dashboard, scroll down and click Test drive for free
in the BigAnimal section:
EnterpriseDB will create a free trial and redirect you to your BigAnimal portal. From this portal, click
Create New Cluster
:
Select the type of cluster and provider you plan to use, then click Next: Cluster Settings
:
Enter a cluster name and password:
Choose a database type, region, and instance type:
Select your storage and networking requirements, then click Create Cluster
:
You'll be redirected to your BigAnimal portal and should see your cluster provisioning like this:
Congratulations! You've now created a BigAnimal Postgres instance on EnterpriseDB which you can use with Hasura GraphQL Engine. Follow the steps below to connect it to Hasura.
Step 4: Get the database connection parameters and finish connecting the database
The structure of the database connection URL looks as follows:
postgresql://<user-name>:<password>@<host-server>:<port>/<database-name>
BigAnimal doesn't provide an out-of-the-box connection string matching the format above. Instead, we'll use the
parameters from the Connect
tab and pass them to Hasura.
After BigAnimal has provisioned the cluster, click on the title:
From the cluster's dashboard, choose the Connect
tab:
For each of the following under Connection Info
, click Copy
and paste their values into the appropriate fields on
the Hasura Console:
BigAnimal parameter | Hasura parameter |
---|---|
Dbname | Database Name |
Read/Write Host | Host |
Port | Port |
User | Username |
Back on the Hasura Console, paste your values into the mapped field:
BigAnimal doesn't present your password on the Connect
tab. You'll need to provide the password you used to create the
cluster in Hasura's Password
field.
Then click Connect Database
.
For security reasons, it is recommended to set database URLs as env vars and using the env vars to connect to the databases in place of the raw database URLs.
Voilà. You are ready to start developing.
Next steps
You can check out our 30-Minute Hasura Basics Course and other GraphQL & Hasura Courses for a more detailed introduction to Hasura.
If using Hasura Cloud, you can also click the gear icon to manage your Hasura Cloud project. (e.g. add collaborators, env vars or custom domains).
For more information on which Postgres features we support, check out this page.