Delete from towns where town_id={{tblTowns.selectedRow.data.town_id}}
If that record has a foreign key relationship the query should and does fail. However, Retool reports success. If I run the same query (with the same value as in tblTowns.selectedRow.data.town_id) in SSMS I get an error referencing the constraint (The DELETE statement conflicted with the REFERENCE constraint "FK__template___town___7BE56230 ...") as expected.
I can check to see if data.rowsAffected is undefined to know that a record was not deleted, but that is a bit clunky. I also cannot report to the user why it failed.
Ok, I am bumping this as it is becoming a major issue for me.
As an example this query returns success:
update invoices set
ship_type_id a bunch of garbage here={{selShipType.value}},,
where invoice_id = {{qryInvoicesSelect.data.invoice_id[0]}}
It is not just one app, I tried to intentionally mess up some SQL queries in other apps and they return success. I am using Azure SQL for these apps. I tried another app that uses Postgres (uses Supabase) and that one does return an error is it fails.
So now if the query fails for some reason, there is not notice of it and it looks like it simply "did not work" which is super frustrating.
Hey @bradlymathews, I'm sorry that your issue has been neglected here for so long I just tried to reproduce this based on your description on my end, and Retool appears to correctly recognize failed queries to a resource setup with Retool's MSSQL integration. Can you share what Retool version you're running?
I am currently using 2.83.10, not on-prem. It also happened yesterday on a different account (different client) to a different database, though it was still Azure SQL.
Hi @bradlymathews, Thanks for writing to us in Support directly about this issue as well as flagging this here on the Community Forum. I'm just posting here for visibility that this is a bug on our end with our MSSQL resource. We have a report in place for this issue and I'll update this post with our progress working towards a fix.
This doesn't fully resolve this issue, but you could define a failure condition for MSSQL queries as {{Object.keys(data).length === 0 && !metadata}}. That way Retool can at least recognize the query as failed.