You can leverage the query implementation to Coffee Bean Library. This library will translate GraphQL queries into SQL queries on the fly. Can be customized and does not require any vendor coupling. I am the author.