SQL Korma
Now that we’ve Clojurized our front end, let’s look at doing the same to our model. Up to now we’ve been using clojure.java.jdbc and writing SQL queries by hand. SQL Korma is a native Clojure DSL that allows us to write the queries using Clojure.[62]
Korma provides a way to write composable queries using Clojure that are translated to the resulting SQL. Because the DSL mimics SQL structure, the resulting queries are efficient and human-readable. The first thing we need to do is include the Korma dependency in our project:
| | [korma "0.3.0-RC5"] |
We can now remove the org.clojure/java.jdbc dependency, as Korma depends on it and will ensure that it’s pulled into our project. To use Korma, we simply need to wrap our connection using ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access