How to use metabase's SQL generator only?

We are building a custom Metabase like engine for our company’s internal analytics dashboard and due to some reasons we cant directly use mertabase. We have developed our own system to run generic sql and download data for generic sql with Celery in EC2 and S3.

In our reports we have a lot standardized filters and we want to generate the SQLs with filters with the exact sameway metabase generates. Is there any library for it or I have to dig into metabase code ?

What reasons exactly? Anything we might be able to do to change that situation?