How to connect Docker Hasura to more multiple Postgre database?

63 Views Asked by At

Says that I have a Hasura running in Container (inside a Kubernetes) and I want this container hasura to connect to 3 different Postgre databases.

Is there a way to configure this without using Hasura console web page, since this has thing to do with scaling later on.

1

There are 1 best solutions below

3
On

You can use the pg_add_source API to dynamically add new Database sources to Hasura.

Conversely, you can use pg_drop_source to remove them.

The above approaches would work in a dynamic environment where Databases are being added and removed reguarly. If they're more static, you might want to consider programatically manipulating the Metadata files and then applying the changes using metadata apply instead.