I am not sure what you mean by connecting directly to the AQL database. Events anf flows are stored in the Ariel database, while the Ariel Query Language is a layer above.
I may not be an expert in the API, but what problems are you encountering when using the searches through the exposed REST API endpoints?
(Side note: I recall I had used in the past something that Chris Meenan posted a long time - an Excel workbook with a macro where you would put your AQL in one sheet and get the results in the adjacent sheet in the same file https://github.com/ibm-security-intelligence/visualizations/tree/master/excel )
------------------------------
Dusan VIDOVIC
------------------------------