This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-02-04
Channels
- # arachne (108)
- # beginners (16)
- # boot (48)
- # cider (34)
- # cljs-dev (12)
- # clojure (237)
- # clojure-spec (50)
- # clojure-uk (5)
- # clojurescript (8)
- # cursive (1)
- # datascript (2)
- # datomic (6)
- # defnpodcast (1)
- # emacs (1)
- # fulcro (7)
- # hoplon (1)
- # keyboards (1)
- # off-topic (22)
- # re-frame (26)
- # reagent (2)
- # specter (16)
- # unrepl (6)
- # yada (1)
Is there a way to do a "group by" in datomic? Let say I have a music database with three columns in the schema: song-title
artist-name
and release-date
. Is it possible to get the latest song-title
released by each artist-name
in a single query?
@didiercrunch if your schema uses references, then pull with map specifications would do what you want : https://docs.datomic.com/on-prem/pull.html#map-specifications
thanks, let me check that!
nevertheless, it is a bit strange there are no way to do grouping as a query... Maybe I need to change more my minds.
@didiercrunch - You may be able to do this with the :with
clause in the query API. I don't understand it well enough to know for sure though.
https://docs.datomic.com/on-prem/query.html#with
If that doesn't work, I would probably just pull all the data and do a manual clojure.core/group-by
on the results. Although if you're not using Datomic on-prem, that might not work so well…
that was my first approach. But I fell it is not idiomatic. I need very fast queries too