View SQL query generated by GUI mode?

Could I get some guidance on how to view the SQL query that is being generated in GUI mode when interacting with Retool DB? I found another post detailing how to store the query variable, but it always comes back blank.

When I preview both queries the output generated is identical (see screenshots) yet when I run them one fails and the other doesn't. If I could view the underlying query I may be able to diagnose why it's failing.

Works:

Fails:

Message:
image

The post regarding the original problem is located here:

Connect dropdown to JSONB field in table. Works as key value pairs, not as form object - Queries and Resources - Retool Forum

Do you mean you'd like to see the positional parameters? As far as I can tell, the SQL generated by the GUI is present in the error message (but the parameters aren't returned).

I was interested in seeing the literal query string, parameters and all, in order to diagnose the problem with passing an array to a JSON field. Still curious if that's possible.

Hello @philone!

To your point that you would like to see the literal query string, unfortunately the query can't show that on the frontend. We have it obfuscated away in GUI mode, the SQL is generated and the sent to the Resource DB all under the hood.

The closest thing would be either from the error message as Michael pointed out or in the app's state under queryName.query but I don't think that will be much use for figuring out why the ($1) is being sent back instead of the JSON with a key of certs and a value of a stringified array :melting_face:

In a perfect world both would work the same or the preview for the failed query could give more info as to why it won't work.

For now we would recommend to you and ass users to use the Changeset of "Key Value Pairs" as I would guess that the Object option in this case might only have the string value and not the correctly corresponding key of 'certs' even though the previewer is showing it.

I will let our team know and see if someone can dig into this further. Have you tried testing the Changeset-Object option for the query with certs: {{form2.data}} ?