honeysql

Discussion of https://github.com/seancorfield/honeysql :slightly_smiling_face:
Adrian Smith 2020-08-07T09:14:49.339900Z

Is HoneySQL 2 going to make interesting changes to the internals?

seancorfield 2020-08-07T16:16:39.342500Z

@sfyire My feeling is that the data representation is pretty good but there are some inconsistencies. I want to document it fully and provide Spec descriptions for it, where possible. The "internals" of the library, beyond the data structure, will be rewritten from scratch I suspect. I'm not sure how much of the existing machinery I'll retain because my goal is to make the use of HoneySQL and the extension of it both much easier.

seancorfield 2020-08-07T16:17:25.343500Z

If folks want to pile in on a long-form, permanent discussion about what you would like to see in 2.0 (and, specifically, what your pain points are with the current version), please comment here: https://clojureverse.org/t/honeysql-what-do-you-want-from-2-0/6360

sandqvist 2020-08-08T10:18:36.343700Z

I use HoneySQL as well as the postgresql extensions at work. I am fairly familiar with the internals as I've had to write my own ltree support. My biggest pain point is the use of macros to generate the helpers. I use Cursive, so I have to type them every time. IMHO the few lines of code saved in the library is not worth the loss of helpful docstrings and autocomplete for some users.

sandqvist 2020-08-08T10:20:27.343900Z

And while it is not a major pain point, I would add input checking to the helpers so that the data representation can actually result valid SQL.

(-> (sql/select :foo)
    (sql/delete-from :bar))
should be an error. This would require the data format to remember the type of the clause being built.

sandqvist 2020-08-08T10:28:29.344200Z

The above change would probably help with the formatting order, which while easy to extend does not seem very robust. For example, doing INSERT INTO .... RETURNING (with the postgres extension) works fine until you try INSERT INTO ... SELECT ... RETURNING as the returning clause in the extension has its priority set too low.

seancorfield 2020-08-08T20:16:01.347300Z

@sandqvist It would be great if you could add that information to either the ClojureVerse thread or this issue so your feedback is recorded somewhere more permanent than Slack: https://github.com/seancorfield/honeysql/issues/270