Run SQL query from string

I have an API which returns an SQL query which is in string format. See below screenshot.

Is there any way that i can run this SQL query in Retool?

Yes, you can.
First, make sure it is checked (can be found in resource settings):

Then just provide you string in the query.

I use postgresdb, i'll try anyways.
Thanks

@ltfrupdt Hi there. Just wanted to check in and see if this worked for you. I went ahead and tested Rati's suggestion and I can confirm that it does indeed work for your use case.

Once you have disabled converting queries to prepared statements, you can reference your SQL string in your query as shown below:

I hope this helps. Let me know if this works for you and if you have any other questions.

1 Like