Selecting a DB system for a Scala/Slick fan

I have a colleague who is excited to use Clojure, but is not a fan of the Yesql approach. At the same time, none of us want the Hibernate approach.

Is there anything similar to Slick for Clojure? Slick is inspired by LINQ.

To your question there is which is pretty cool

I would personally love something that looks like this:

(deft posts {:id “serial primary key”
             :title “text”
             :body “text”
             :published “boolean not null default false“})

(defn published? [post]
  (true? (:published post)))

(sql/filter published? posts) ; => [“select * from posts where published = ?” true]

I have no idea how this would work or if it’s even possible. So the deft would be a “smart” migration and there would be analogous functions for map/filter/reduce that emit sql and maybe you could traverse through a relational database like a huge nested map, automatically creating join queries along the way. :sweat_smile:

Or I guess just use datomic haha

If you want a SQL DSL, you can use HoneySql or Sqlingvo or Korma.

None of them will be like Linq, because Linq is also a Dsl. So you can use the same DSL for sql and datastructure querying. While map/reduce is just plain old functions in Clojure.

Building non trivial queries with yesql approach can become tedious quickly. Walkable is a new (and efficient) approach to SQL in Clojure.

Basically you define the schema and write queries in plain Clojure, so I guess it matches Slick’s Scala-ness and composability.

So this is more about selecting a SQL wrapper than a DB, correct? Otherwise, you should check out Datomic :slight_smile:

That might be too much of a leap at this point, but it’s a great idea.

I would also like to mention that you can use datahike as a FOSS Datomic replacement for simple needs:


Datahike is super interesting! I’m going to give it a shot