I am trying to dynamically get a count of the non-null values for columns with a certain test. For example, if a column has a certain test, I would like to get that test’s name, and the COUNT() for that column from its respective model.
I want to bump the number of failures for each test against the number of non-null values to calculate a percentage
Currently, I have created a model with a query like this for each test, but I’d like to do this dynamically so I don’t have to keep adding a new union statements manually
SELECT
<name_of_test> as test_name
COUNT(<column_name>) as entries
FROM
<model>
UNION ALL
-- repeat for each test