How to get SQL Query response

I'm trying to update a record and I want to see the query response like this: 1 row affected

1 Like

You can enable query transfer results to add some JS to modify the result before return

@AnsonHwang I want this to be dynamic like how many rows are updated with updated Query.

Hi @Dirshant_Kumar, Could you use the length of the values you're passing in to the query?

For example, in this update query, I could use {{table1.changesetArray.length}} to get the number of records to be updated:

You could store that value in a JS query or temp state so that it doesn't get cleared after the update happens

@Tess What I want is to get the response after query execution, For Example, I am updating 10 rows and on that, all 10 rows are updated, Now I want the response from the DB itself like 10 rows affected. the same as we see in the logs of MySQL Workbench.

Hi @Dirshant_Kumar The Retool query will return the exact response that is coming from MySQL; Retool doesn't do any transformation on the results from MySQL unless you set this up with Javascript in a query transformer.

Are the MySQL Workbench logs something that you could query in Retool?

I just wanted the logs as shown on the workbench, when you update a record it shows a response something like this "1 row affected".

1 Like

This is not supported as a Retool setting unless you're able to use a workaround of querying the data or using Javascript. It seems like you may be able to use Row Count() if you write your insert/update query in SQL mode