Multiple Postgres databases

Hi Support Community,

I'm a relative newbie and would like to do the following, but not sure where to start!

I have a Select menu - with options 'DatabaseA', 'DatabaseB', 'DatabaseC' - depending on the selection I would like the rest of the Retool app to only access that particular database.

I can setup 3 individual POSTGRES connections (DatabaseA, B & C) but that's not very 'dynamic' - especially if I add DatabaseD to the list...

How would you go about setting this type of scenario up on RETOOL?

Many thanks,

Alan

Hi,

I'm working with Alan so will try and unpack that.

We are using an external database via a resource, call it DB_Connection. Is there any means using javascript to access and change the attributes of that connection so, for example, in real time change the Database name from 'Production' to 'Test', and the Database username and password?

I hope that clarifies what we're attempting.

Thanks!

Chris

Hey folks!

There's an experimental feature flag we can turn on to let you dynamically set the resource for a particular query from within your app. More information in this post! With that, you can:

  • Create a separate resource for each database
  • Grab the UUID of each resource and set them to be the values in your select
  • Change the label to match the name of your resource/database
  • Pass {{yourSelect.value}} into the dynamic resource field of your query

Does that look like it could work for your use case?

Hi Kabirdas, could you turn this feature for me too please? Thanks

1 Like

@grae, It's been enabled!