Rookie API/sql/display

I’m very new to this type of program. So far I’ve been able to get variables to work.
The biggest problem I’m faced with is that I need WAY_WAY too man questions. The app I’m trying to replace is currently written in perl CGI. a VERY large portion of that code is to write SQL. The creation of images and charts is a small portion. To give you the concept of scale fo the number of questions I need, I have 13 products that are displayed within this app. Each product has 6->12 “WHERE” pieces fo the sql. There are @ 35+ columns per row in a MariaDB.
The tables with 12 WHERE variables would need 4096 questions. Even using the API to generate load the questions I would generate, no one is goinf to accept a dashboard with 4K questions, totally worthless.
What I’m considering is to keep all my perl that generates the SQL, has the security built in and pass the SQL to metabase for generation of the graphs and charts.
Is this possible with Metabase and could someone give me an example of something as simple example?