honeysql

Discussion of https://github.com/seancorfield/honeysql :slightly_smiling_face:
seancorfield 2021-02-03T00:59:30.063Z

(writing documentation is taking me longer than I'd hoped so I'm not going to cut an alpha release to http://clojars.org just yet -- but folks are still welcome to try it out via {:git/url "<https://github.com/seancorfield/honeysql>" :sha "4cbeb170ddf4ba0d7238c43b092ffb0a33062474"} 🙂 )

seancorfield 2021-02-03T01:00:41.063400Z

Special syntax docs https://github.com/seancorfield/honeysql/blob/v2/doc/special-syntax.md

seancorfield 2021-02-03T19:49:21.064300Z

If anyone does take v2 for a spin, please provide feedback -- good or bad.

dharrigan 2021-02-03T19:59:15.064700Z

Hi Sean. I plan to do a bit of playing around in the next few days with it. Slightly busy at work atm.

dharrigan 2021-02-03T19:59:43.065100Z

Hopefully I'll have positive feedback 🙂

markaddleman 2021-02-03T21:52:00.068300Z

@seancorfield Where did you land regarding spec and v2? Personally, I'd love to have a honeysql spec. I do a lot of programmatic SQL generation and transformation. I believe that having a spec will help create a honeysql AST that will make transformations easier.

seancorfield 2021-02-03T22:01:08.069200Z

@markaddleman Still on the roadmap but it's much harder than I initially thought -- since it's basically the Spec equivalent of SQL's entire syntax 🙂

markaddleman 2021-02-03T22:01:39.069400Z

ha. Yeah, that was the conclusion I came to. I was hoping you had some magic up your sleeve

seancorfield 2021-02-03T22:02:57.069600Z

Writing a Spec that just says "this data structure is acceptable to HoneySQL" is fairly tractable but that's very lax -- HoneySQL can format all sorts of otherwise rather dubious "SQL" 🙂 No guarantee the SQL itself is valid, however...

seancorfield 2021-02-03T22:06:03.069800Z

Since I want v2 to accept as much of the existing data structure DSLs out there which are used by v1, there are some inconsistencies I don't want to fix. At the same time, I've made v2 a bit more lenient in some cases where there's no ambiguity.

seancorfield 2021-02-03T22:10:18.070300Z

There's no good way to consistently make the "mistake" genuinely illegal without also prohibiting strange-but-legal stuff...

seancorfield 2021-02-03T22:11:30.070500Z

I certainly could make v2 stricter (and disallow '{select id from table where (= x 42)}) but it would also make it more complex and probably less easy to use 😐

seancorfield 2021-02-03T22:12:03.070700Z

(and v2 deliberately accepts symbols and lists where v1 only accepted keywords and vectors -- because folks want the quoted datalog-style query format)

markaddleman 2021-02-03T22:16:47.070900Z

Understood. I encountered similar issues. I author queries by hand using using honeysql's syntax but the very first thing my transformation system does is "normalize" it (eg, all column projections have aliases, all tables have aliases, where clause expressions are converted to SqlCall records, etc).

markaddleman 2021-02-03T22:17:49.071100Z

I despair of writing a spec for the unnormalized structure but the normalized data wouldn't be too bad