O'Reilly logo

Web Development with Clojure by Dmitri Sotnikov

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required