0

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.

Jackk-Doe
  • 109
  • 7

1 Answers1

2

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.

Jesse Carter
  • 20,062
  • 7
  • 64
  • 101
  • Thank you for the answer. In my case there would be 3 static databases to connect with, so could you please suggest (or give a link) how could I do the programatically manipulating the Metadata files things ? – Jackk-Doe Feb 08 '23 at 06:54
  • In addition, would the solution works with Hasura Docker ? since I will have to use Hasura via a Docker Container and Kubernetes. So I would need the Hasura and database connection to be done, without interacting with Hasura console. Thank you in advance. – Jackk-Doe Feb 08 '23 at 06:57
  • I don't have an example, you would have to write a script that modifies the contents of he relevant .yml files if you were going to try that approach. You may just want to stick with the documented APIs that I've provided in the links above to register your sources – Jesse Carter Feb 08 '23 at 16:05