Looking for a ruby gem package to parse SQL query

Hi,

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.

I’m using ruby for the ELK Logstash and therefore needs jRuby support.

Here’s what I’m trying to do:

Query like below

select 
     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

{
"select": 
    {"value": "table_1.userId", "name": "col_0_0_"}, 
"from": 
     {
          "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.