Unit tests in SQL queries

Is there a way to add unit tests to the SQL queries stored in Metabase? I haven't found how to do it and it would be very nice!

What are you looking at testing?

I have a set of quite complex SQL queries and I would like to have some unit tests to make sure that they are doing what I think they are doing and to make sure that if I edit them (for instance to increase performance) that I don't modify their behavior by mistake.

My idea would be to query a test DB that has the same structure as my "real" DB using the query that I have written in SQL, and check that the result is what I expect it to be. Then, every time I click on the save button, the tests would be automatically run and I'd get a warning message if they fail.

Does that make sense?

I am not sure this is really possible with metabase since it doesn't even support multiple statements.

The way i think this should be approached is by having an external service that would query a question via the API and then match it with the Database to check for any irregularities and flag problems/warnings if something is wrong

You should be using a framework like great expectations for this, Metabase is not the right tool