Parsing SQL queries using ruby; any recommended gem package?


I'm new to Ruby language and I thought I could still do a simple task of normalizing + parsing SQL query using some third party library; but I had no luck finding any that works to my intention.

Here's what I'm trying to do:

Query like below

     table_1.userId as col_0_0_ 
from tbUserTable table_1 
     where table_1.createdDate between '2021-05-23 00:00:00.0' and '2021-05-23 23:59:59.999' 
group by table_1.userId; 

will transform into JSON like below

    {"value": "table_1.userId", "name": "col_0_0_"}, 
          "value": "tbUserTable",
          "name": "table_1"}, 
"where": {
          "between": ["table_1.createdDate", 0, 0]
"groupby": {"value": "table_1.userId"}

Also please note that the parameters inside WHERE condition has been normalized to 0, 0.

If there is any Ruby Gem package that I could use on Logstash ruby filter that anybody's aware of, I'd love to know!

Thanks in advance.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.