I've done a fair bit of complex SQL with honeysql, and must say it rocks. 
It could use a bit more documentation where extending it with new clauses 
is concerned, though.

For my latest project being able to manipulate the datastructures that are 
rendered to SQL was crucial, and honeysql was the only one that fitted that 
bill. Basically, it generates SQL scripts to relink foreign key references 
to clean up duplicates in a database. It takes a honeysql select query with 
(at least) a from table, a group-by and an order-by clause as a base 
definition what are to be considered doubles, and in which order records 
should be preserved. In combination with JDBC metadata that query 
effectively gets rewritten to generate:

A temporary replacement table
Queries to unify unique indexes, to prevent clashes when foreign key 
references are updated
Queries to update all foreign key references
Delete statements to remove all duplicates

To create the best performing, but still database independent SQL, I had to 
extend honeysql with extra clauses like OVER and PARTITION BY. I wouldn't 
say it was a breeze, but seemed to work very well.
Compared to the previous version I wrote in Ruby (without these clauses), 
the SQL now only scales with the amount of unique / foreign key 
constraints, instead of the amount of doubled sets.

That cut down SQL to (sometimes) GB's of script to around a few 100 lines 
of SQL, and on one occasion, a runtime from 19 hours to 1.5 minutes.

All in all, pretty impressed with Clojure and HoneySQL.


On Tuesday, February 24, 2015 at 3:04:36 PM UTC+1, Colin Yates wrote:
>
> Hi all,
>
> What are you all using for interacting with an RDBMS? In the past I looked 
> at clojure.java.jdbc, honeysql and korma (and for querying, honeysql just 
> rocks). I have lost touch a bit - any recommendations?
>
> Thanks.
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to