This happens because Retool doesn’t trigger cell click events on non-editable columns. That’s why your AddPatient3 query works in development but not when clicking the table cell.
Fix
Make the column editable, or
Use a Button column (recommended) and trigger AddPatient3 from its click event