#Fetch Data from Multiple DB

1 messages · Page 1 of 1 (latest)

dapper tinsel
#

Hi
I have a use case wherein i have stored customer details in 2 different SQL DB (say for example DB-1 and DB-2) . So DB-1 has a list of customer from 1-100 and DB-2 has a list from 101-200.
Now i want to search the customer by customerId.
For example if i search by id -1 , i need to fetch from DB-1 and if i fetch by id-200, it has to fetch from DB-2.
I have a single table in my UI.
How can i do this is appsmith, wherein if customer searches by a particular ID, either DB-1 or DB-2 has to be selected and the query has to run.

stone shuttleBOT
#

Hey There,

We've registered your query, and our team will get back to you soon.

Regards,
Pranav

stone shuttleBOT
#

Hey!
The way to do this is to use two queries, one for each DB. Then write a
conditional logic in JSObject to fetch the data from the appropriate query and
merge it.

dapper tinsel
#

ok will do this and test