SQL Sensor with Mariadb stored function

Hey all,

I want to create a SQL sensor with a call to a MariaDB stored function that does some Select/Delete/Insert commands.

I created my function using phpmyadmin, with the same db user I use in home assistant, and I can manually run my function from command line or phpmyadmin (still with the same db user as HA) and it runs absolutely fine…

Only issue, from HA, I created the SQL Sensor using “SELECT my_stored_function() AS result”, when the stored function runs it does return the Select result (from inside the function as expected, so the SQL Sensor works OK), BUT it doesn’t do the additional Delete/Insert part of things from inside the mariadb function.

Any idea why this is happening ?