4 ms·
But your missing the point. You can store parts of queries and reuse them, recombine them however you see fit: (def users (cql/table db :users)) (def photo
by swannodette 16y ago
But your missing the point. You can store parts of queries and reuse them, recombine them however you see fit:
(def users (cql/table db :users))
(def photos (cql/table db :photos))
(def users-and-photos
(cql/join users photos
(cql/where (= :users.id :photos.user_id))))
(def photo-titles
(-> users-and-photos
(cql/project #{:photos.title})))
Note that my queries just keep getting smaller and smaller ;) By writing the mundane portions of your SQL queries again and again by hand you will have more duplication.
- andreas_bak 16y agoYes I agree. But, I believe that it is just a perversion. In any project that involves RDBMS writing queries is just a small part of development. Surely you could modify queries with Clojure-QL (with SQL it will be a suicide) but what you gain from it ??? (more free time - I don't think so). Furthermore, having such dynamic "meta-"things in your code, eventually will cost you more time in debugging it. With SQL it is straight-forward: you prototype your query using some GUI client and then you just embed it in your program. How it can be done with Clojure-QL ?