I built an app where each user has its own database SQL connections and since it’s getting a little bit crowded…I start to have issues on organizing my app.
1st problem: till now each user needs to run 15 different query (using Bubble SQL Database Connector) to their Microsoft SQL and every time I need to work on editing or adding a new query the bubble editor is crashing (I have 450 different query as of today and need to keep adding)
2nd problem: all the users have the same dashboard but each dashboard has to be connected to the user’s specific SQL Database so I tried to create a Reusable Element but is not working since the RE cannot be linked individually. This situation creates a big headache cause every time I do a change on the UI or UX I have to manually do it on each user’s page.
Interesting. 450 of anything in the Editor is going to become cumbersome. And likely blow up memory in your Browser.
Anyway of generalising the queries? Conflating some queries with views perhaps?
One pattern I use sometimes is to “sync” the external database tables to a bubble table at run time. Eg at user login time I go off and get all the external data I will need on a backend workflow, one operation. Then subsequently everything is simplified as it is just a bubble table to the Bubble user. Simplifies credential management also. It’s for special cases. But could be an idea for you.
The cheeky answer is get a new MacBook with 32 G of memory
@lindsay_knowcode thank you for taking the time to address my issue.
The query is unique but I have to run it for each user since the connection to the db is unique to each user.
Just trying to help a friend bringing in 2025 his old ERP built on an (very) old version of Microsoft SQL and C++. He wants to keep it as it is…and some functions that cannot be done there…I can do it on bubble. And was working great…until user #15 more or less. Now I have 30 of them…and continue to add.
Is more of a problem on how his DB is structured. Instead having 1 Data Type where each user is creating his thing…he has Data Types for each user. So if I connect to Data Type User XXX I can only get the items created by User XXX.
This is why I need to run same query for each user separately. 30 users x 15 query (till now) = 450 queries.
Would be easy for me to add a line in the query saying bring me the info for this user from Data Type AAAA and run 1 single query for all of them.
Ur suggesion to “sync” the external tables to a bubble table…still requires to have all those queries for each user. On some tables I get the data…on some others I update the data and on others I create new items.
In some situations although I deal with same table I have to run 2 different queries cause I did not find a solution to combine them and obtain same results in just 1 query.
The basic issue is that with the SQL connector you can’t parameterise the connect string. (like you can do with the API connector) - which is a shame and would be a good solution to your issue. I doubt it but any chance there is a REST API to the db so you could use the API connector?
No REST API
I would have used it in first place instead getting crazy with this.
The ultimate solution that I am thinking about is to clone the app for each user.
Would solve my problem #1
But I will still have to deal with problem #2
I mean…applying manually the edits I do now on each user’s page…or doing it on each user’s app…is no difference…only a big headache…and getting bigger by every new user we keep adding.
Create a function (Cloudflare is fashionable) that takes a Client id (an identifier for each of you user connect strings) and the SQL query.
Switch (if/then/else) on the Client id to resolve the Client’s correct connect string. Run the query and return a Json REST representation of the result set. (many libraries and AI to help you do that)
So one Cloudflare function for all queries.
One Data API API endpoint within your Bubble app. (with 30 different calls - the difference beoing teh SQL passed in each call)
Separate apps or Subapps - I don’t think you need to do this. Just create this little “proxy” wrapper for all the Databases you need to connect to.
I checked ur plugin and I am not sure I understand how this plugin will solve my problem. Did you read my 1st reply to lindsay_knowcode where I put screenshots with my SQL Connecter settings?
Maybe I am missing something in your plugin? Can you please give me more details on how I can use ur plugin to solve my problem?
I will be more than happy to pay for the PRO if it solves my problem.
The plugin allows you to create dynamic connections. If I was understanding you correctly your problem was you wanted a different connection for each customer…
different connection for each user…is what I currently have with Bubble’s native SQL Connector and it creates me a big headache. For each connection I have 15 queries. So 30 users = 30 connections x 15 queries = 450 queries. This is my problem.