4 ms·
The main thing preventing me from using Clojure on the backend has been that db libs (pgsql, mysql) seem to not be under particularly active maintenance/develop
by bpicolo 9y ago
The main thing preventing me from using Clojure on the backend has been that db libs (pgsql, mysql) seem to not be under particularly active maintenance/development, which also feels at least somewhat true for other libs in the ecosystem. HugSQL as recommended by Luminus hasn't seen any development in the last year. What's been your experience here?
- yogthos 9y agoAll the heavy lifting is done by the JDBC drivers implemented in Java. These are mature and very stable. Clojure libraries wrapping these drivers simply provide a more idiomatic API to them. I'm not sure which db libs you've looked at, but the most used one is https://github.com/clojure/java.jdbc https://github.com/clojure/java.jdbc and it's just a wrapper for the Java JDBC API. The Postgres/MySQL connections are managed by the official org.postgresql/postgresql and mysql/mysql-connector-java driver libraries. HugSQL hasn't seen much development, because it works well. I'm using it in all my projects, and it's been working perfectly for me. The library has a fixed feature set, which is taking SQL templates and generating functions that make JDBC calls based on them. Now that it's feature complete, the only time you'd see changes would be if the underlying API changed, or for a bugfix. The last commit actually happened 28 days ago, and it was a bump in dependencies. Just because the repo isn't active is not an indication that the library is abandoned. My experience with Clojure libraries, is that this is usually an indication that the library works well and most bugs have been ironed out. Looking through the issues is generally a better approach of checking the health of the project I find. If stability of database connection libraries has been your concern, I can assure you that it's misplaced.
- bpicolo 9y agoThanks for the reply! What would you recommend if I wanted something with a query-builder style API? In my head it seems like clojure would be a really great fit for that as a modular way to build statements.
- yogthos 9y agoI would recommend taking a look at https://github.com/jkk/honeysql https://github.com/jkk/honeysql that uses Clojure data structures to represent SQL statements. It's similar idea to Hiccup for HTML.