SQL Database Connector not working with parameters

I’m trying to use the SQL Database connector and it works fine, until I try to introduce parameters.

This query works completely fine, returning the 1 result I’m looking for in my repeating group.



Of course, I don’t want to hard code my user’s email into the query, so I want to replace the email string with a parameter. However, with just that single change, and testing with the same email that was hard-coded in the first query, the 1 result no longer appears in the repeating group.

Query with parameter:

Configuration of repeating group updated so parameter is the same value that was hard-coded in the test:

Empty repeating group:

Any ideas? Thanks in advance.

Could it have something to do with the fact that the value “account” in my SQL database is varchar but the Bubble value is “text”…? To me that still doesn’t explain why it worked fine when the value was hard-coded. Smells like a bubble-side issue to me…

Screen Shot 2022-08-27 at 10.25.30 PM

Your reference to Currentuser is incorrect.

For MS SQL it should be
where account = @Currentuser

or otherwise $CurrentUser for mySQL

The parameter in the input box is correct. i.e it does not need the character before it, only the one in the query does.

1 Like

This is what happens when I make the change… (I am using mySQL) I get an error from Bubble saying it’s an unknown column. To clarify, account is the column name, and the email string is the value.

Screen Shot 2022-08-28 at 7.34.28 AM

Update: I was able to configure with the syntax where account = '$CURRENTUSER' , however the table still returns empty. Any help would be greatly appreciated!

I use MS SQL, so am not too sure of MYSQL requirements. Do a search on the forum, there are MANY posts around the topic.

With MySQL, you just put a “?” (no quotes) in place of the parameter. The list of parameters is simply the name you assign them that will be prompted in the data source when specifying in Bubble. So edit your query as follows:

select * from service_auth_linkage
inner join auth_user au
on user_id=au.id
where account=?
limit 10;

Name your parameter something descriptive, like CurrentUserEmail. Type is Text.

That should test fine. Then when specifying the data source in Bubble, it will ask you to put a value for CurrentUserEmail at which point you would add the Current User’s email.


I’m late to reply here, but this worked!! Thanks so much.