honeysql

Discussion of https://github.com/seancorfield/honeysql :slightly_smiling_face:
borkdude 2021-03-02T10:33:24.045400Z

As a bit of user feedback: It's been several times now that I've been reading the README and I have trouble resolving mentally where some vars are coming from due to the use of :refer :all. E.g. right now I'm searching where insert-into is coming from (again). Can the README maybe use an alias, or an explicit :refer [...]? Or can all of these functions maybe be part of the honey.sql namespace?

3➕
seancorfield 2021-03-02T17:32:30.048900Z

The helpers have always traditionally been in a separate ns and that folks can either :refer specific ones or use an alias as they prefer. I think the DSL reads much more clearly with referred symbols than with using an alias. In v2 there are only two namespaces: honey.sql for working with the data structure and format'ing it, honey.sql.helpers with all the helper functions. In v2, honey.sql has one primary API: the format function, and you only care about the other public functions if you're extending HoneySQL.

seancorfield 2021-03-02T17:40:23.054200Z

I get the impression that only a minority of HoneySQL users rely on the helpers at all -- most folks seem to prefer to work with the data structures and just sql/format. I'm still working on the docs (the major piece of work blocking a "gold" release) and I'll definitely make a couple more passes over the readme. The readme already has [honey.sql.helpers :refer :all :as h] (v1 had :as helpers instead of :as h and used that alias in precisely one place, to disambiguate update).

iarenaza 2021-03-04T15:45:41.079500Z

One data point: we use the data structures, unless we need to resort to using sql/raw for certain Postgresql-specific constructs not supported in HoneySQL 1.x. Sometimes we need to dig into the code a bit to find the exact shape of the data structures because the README mainly uses helpers (e.g., to do a multi-JOIN) but the code is extremely clear and helpful (thanks a lot for that!)

iarenaza 2021-03-04T15:46:49.079800Z

Looking forward to migrating to v2, as some rough edges of 1.x have been polished quite a bit!

seancorfield 2021-03-04T17:20:33.080100Z

Thanks, I hope the new SQL Clause Reference docs in v2 solve the "exact shape of the data structures" issue?

seancorfield 2021-03-02T17:43:00.054900Z

(as for moving the helpers into honey.sql -- definitely not, at this point)

borkdude 2021-03-02T18:14:35.055400Z

@seancorfield I was using insert-into since I didn't know how to do this using data structures

borkdude 2021-03-02T18:14:50.055700Z

There were no examples I could find on this

borkdude 2021-03-02T18:19:53.057Z

@seancorfield I'm referring to the main README where I ctrl-f-ed on insert which only comes up with examples with insert-into (from the namespace I had to guess)

borkdude 2021-03-02T18:20:17.057600Z

if :insert-into is preferred, maybe the main README should suggest this instead?

borkdude 2021-03-02T18:20:24.057900Z

I had no idea it existed

seancorfield 2021-03-02T18:21:25.058900Z

Everything has always been available as data structures. The helpers in v1 don't even cover all of the clauses. When I overhaul the README I will link more heavily to the reference doc sections.

seancorfield 2021-03-02T18:22:27.060Z

I will also make the whole data structure vs helper DSL thing clearer (the v2 readme is still modeled after the v1 readme, for the most part).

borkdude 2021-03-02T18:22:47.060200Z

Thanks!

seancorfield 2021-03-02T18:25:28.060600Z

(this is good feedback esp. since you're a new-to-HoneySQL user, right?)

borkdude 2021-03-02T18:26:43.060800Z

yeah

borkdude 2021-03-02T18:27:27.061700Z

I'm using it now from babashka mainly to poke at our work database, since this is faster than pgadmin which is annoyingly slow right now when connecting to a database in the US region (from Europe)

seancorfield 2021-03-02T18:28:09.062300Z

Feel free to add any and all readme/doc thoughts to https://github.com/seancorfield/honeysql/issues/307 so I don't lose track of any suggestions.