Is there any support for postgres's CTE?
Yes, via “with”
Iirc the merge helper is missing
AFK right now so can’t help with sample code
fwiw, I have extended honeysql to support BigQuery CTEs (which are similar to Postgres CTEs). It was pretty easy
(defmethod fmt/format-clause ::with [[_ ctes] _]
(str "WITH " (fmt/comma-join (map (fn [[cte alias]]
(try (str (fmt/to-sql alias) " AS " (fmt/to-sql cte))
(catch Exception e
(throw (ex-info "Unable to format"
{:alias alias :cte cte}
e)))))
ctes))))
@nasikebuli156 :with
and :with-recurive
are supported by HSQL. You can see usage https://github.com/seancorfield/honeysql/blob/5e087617159fa61a15363bf76ad3d6598dd7d30f/test/honeysql/format_test.cljc#L62
And then I usually take a look at https://github.com/seancorfield/honeysql/blob/5e087617159fa61a15363bf76ad3d6598dd7d30f/src/honeysql/format.cljc#L222 when I need to remind myself of some of the options. I also build the HSQL manually and without helpers…a habit I would like to break because I imagine that they are actually “helpful”
HoneySql 2 looks promising. What is the state of it? Is it too early to start using it?
@janne.sauvala agreed. I’m not speaking for Sean, but TMK it’s still in an “evolving” state.
@janne.sauvala v2 is very much in "hammock mode" right now. The v2 branch mostly works but there are some features from v1 not implemented yet -- still figuring out the best approach. Several features will behave differently but v2 uses different namespaces (and will have a different Maven coordinate: seancorfield/honeysql
) so you can load both v1 and v2 into your project and migrate piecemeal.
Good to know I can use them at the same time - I might go that route if I feel that v2 seems to be more superior 🙂
I'm hoping to have something "usable" next week. I'm taking four days off to work on OSS (Thu-Tue) and I plan to deal with the parameterization issue which is the current blocker as far as I'm concerned. If I can get that working this weekend and get all the tests to pass, then I'll probably ask folks to test it -- if I can also get enough documentation in place.
I don't consider it even "alpha" yet and I'm not yet trying to use it at work 🙂
I think Clojure has spoiled me with the definition of “alpha” in our community. Usually alpha versions of any Clojure lib works fine but in any other language those alpha versions barely even compiles 😄
I'm taking a few days off at the end of this week (Thursday through Tuesday) and plan to spend quite a bit of time on OSS projects -- which is possible because of GitHub sponsorship! I'll probably tackle stuff in the order: next.jdbc
, depstar
, clj-new
, and then HoneySQL v2 (but those first three projects only need a few hours of time on them).