honeysql

DrLjótsson 2023-05-21T16:49:45.049139Z

Anyone aware of efforts to turn string SQL queries into honey sql? Via an AST maybe? This was my first hit when I googled for a sql parser https://github.com/JSQLParser/JSqlParser

refset 2023-05-21T17:01:18.530239Z

The XTDB 2.x SQL parser & AST rewrite namespace might be a reasonable starting point for such a thing https://github.com/xtdb/xtdb/blob/2.x/core/src/main/clojure/xtdb/sql/plan.clj

refset 2023-05-21T17:03:58.743729Z

Maybe something more simplistic could be built specifically for HoneySQL without needing the full semantic analysis machinery, but I wouldn't bet on it 🤔

seancorfield 2023-05-21T17:04:09.126859Z

It's been asked repeatedly over the years but SQL parsing is a massive effort -- as the XTDB folks know -- and completely out of scope for HoneySQL.

seancorfield 2023-05-21T17:05:33.261879Z

See https://github.com/seancorfield/honeysql/issues/182 for at least one thread on it -- and why an ANSI SQL parser alone is not sufficient.

👀 1
DrLjótsson 2023-05-21T17:26:26.771689Z

Yeah, I see the issues with being dialect neutral. For me it would be a one-off thing to convert lots of pretty standard MySQL queries into HoneySQL. So I was interested in hearing if anyone has done something similar for migration rather than a general solution.

seancorfield 2023-05-21T23:20:45.394599Z

I'm not sure if anyone here is trying to use ClojureCLR but I just pushed some changes to HoneySQL to get at least basic compatibility in place... testing and feedback welcome!

❤️ 1
🎉 1