Best Practices for Connecting Multiple Databases in Retool

Hello Everyone :hugs:,

I’ve been working with Retool for a few months now and I’ve had a great experience building internal tools for my team. However, I’ve recently hit a bit of a roadblock and could really use some guidance.

My current project requires connecting to multiple databases (both PostgreSQL and MySQL) and integrating data from these sources into a single Retool app. I’ve been able to connect each database individually, but I’m struggling with the best way to manage and query data from both databases simultaneously within a single app.

Some specific questions I have:

  1. Best practices for multi-database integration: What’s the most efficient way to set up queries that pull data from different sources? Should I be writing separate queries for each database and then merging the data in Retool, or is there a better method?
  2. Handling joins across databases: In a SQL environment, I would typically use a JOIN to merge data from different tables, but since the data resides in two different databases, I’m unsure how to replicate that behavior. Has anyone successfully managed cross-database joins within Retool, and if so, how?
  3. Data security and performance considerations: When pulling from multiple databases, what are the key security or performance implications I should be aware of? Are there specific settings within Retool I should configure to ensure smooth performance and secure access?

Any insights, examples, or gcp resources would be greatly appreciated! Thanks in advance for your help.

Hi @KelvinG! Welcome to the community. :slightly_smiling_face:

One of Retool's greatest strengths is it's ability to integrate with multiple data sources, even from within a single application. Are you looking to present that data to your users as if it is from a single source? Generally speaking, you should write separate queries that hit each data source and then merge them on the Retool side. The best way to do this is to utilize "Query JSON with SQL" to join the results of the two individual queries.

There's nothing in particular that I can think of or recommend when it comes to security and performance. Like I said, this is what Retool is built for!

1 Like