Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

describe differences between sqlingvo, honeysql, and korma? #79

Open
AlJohri opened this issue Apr 26, 2017 · 2 comments
Open

describe differences between sqlingvo, honeysql, and korma? #79

AlJohri opened this issue Apr 26, 2017 · 2 comments

Comments

@AlJohri
Copy link

AlJohri commented Apr 26, 2017

It would be really helpful for me, especially as a novice clojure user, to have a description of the differences between sqlingvo and the others sql libraries along with the motivation for creating sqlingvo.

I think the main libraries in this space are sqlingvo, honeysql, and korma. I'm sure there are others, but these seem to be the major libraries that support using clojure data structures to write SQL (unlike yesql and hugsql which support a SQL first approach).

@r0man
Copy link
Owner

r0man commented Apr 26, 2017

@AlJohri 5 years ago, Korma didn't serve my needs, so I created this. I haven't used any of the other SQL libs you mentioned. I'm only aware of this comparison:
https://adambard.com/blog/clojure-sql-libs-compared/

@AlJohri
Copy link
Author

AlJohri commented Apr 27, 2017

cool, thanks for the insight!

If you ever get a chance to look into honeysql, I'd be interested to hear your thoughts. As a novice clojure user, I'm finding the use of native clojure maps to describe a sql query pretty useful for the purposes of composition and learning very little to get started.

ex:

(defn translate-generic-query [options record-query]
  (merge
    {:select (select-json-keys :a.original (:$project options))}
    {:limit (:$limit options)}
    {:offset (:$offset options)}))

(defn translate-article-only-query [options record-query]
  (merge
    (translate-generic-query options record-query)
    {:from [[:articles :a]]}
    (when (contains? options :$sort)
      {:order-by (parse-sort (:$sort options) :table "a")})))

The article you linked mentions:

SQLLingvo works a lot like HoneySQL, but defines a slightly different-looking DSL and eschews the intermediary maps (actually, it does use maps if you try executing the functions alone, but they’re a lot less readable than HoneySQL’s). Instead, the base query functions (select etc.) can contain forms modifying the query, and it applies the transformations internally rather than externally as in honey.

I'd be curious what benefits you found by having an intermediary like sqlingvo.expr.Stmt while creating sqlingvo.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants