This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-01-13
Channels
- # admin-announcements (1)
- # announcements (40)
- # aws (2)
- # babashka (46)
- # babashka-sci-dev (106)
- # beginners (31)
- # cider (5)
- # circleci (2)
- # clj-kondo (48)
- # clojure (118)
- # clojure-belgium (1)
- # clojure-chicago (3)
- # clojure-europe (19)
- # clojure-ireland (3)
- # clojure-losangeles (2)
- # clojure-nl (2)
- # clojure-spec (10)
- # clojure-uk (4)
- # clojurescript (18)
- # community-development (5)
- # core-async (159)
- # cursive (16)
- # datomic (16)
- # etaoin (1)
- # fulcro (21)
- # funcool (14)
- # graalvm (5)
- # gratitude (4)
- # holy-lambda (28)
- # jobs (1)
- # jobs-discuss (1)
- # kaocha (1)
- # lsp (12)
- # malli (21)
- # meander (12)
- # music (1)
- # off-topic (8)
- # portal (5)
- # react (18)
- # reitit (1)
- # releases (4)
- # remote-jobs (1)
- # shadow-cljs (56)
- # timbre (4)
Can I :find the count of all unique combinations of my :find vars? e.g., In :find ?name ?duration
, I want the query to return the count of all unique [?name ?duration] tuples.
if you’re on-prem, just count
the result of the query. There’s no overhead vs doing the count in the query
if you’re client or cloud: :where [(tuple ?name ?duration) ?name+duration] :find (count ?name+duration)
Datomic Cloud: Is the :db.unique/identity
& upsert behaviour different for composite tuples?
For a unique :my-id
I can transact this multiple times:
(d/transact conn {:tx-data [{:my-id #uuid "cffeaaf9-861c-4aee-857f-dd0d704aa608"}]})
But not...
(d/transact conn {:tx-data [{:x 101155069823622
:y "bar"}]})
For unique :x+y
tuple.
Seeing Unique conflict: :x+y, value: ...
To use a composite tuple with upsert effectively, you need to assert the new composite yourself
So in the example above, would need to add :x+y
e.g.
{:x 101155069823622
:y "bar"
:x+y [101155069823622 "bar"]}
?If that’s the case, this sentence “Composite attributes are entirely managed by Datomic–you never assert or retract them yourself.” (https://docs.datomic.com/cloud/schema/schema-reference.html#composite-tuples) might be a bit confusing? It did threw me off. Maybe just a misunderstanding on my part.
Thanks for clarifying 🙏 I just mentioned the docs, because they put me on the wrong track 😉 Good to know about the edge case!
In case you wanted info from the datomic team https://forum.datomic.com/t/db-unique-identity-does-not-work-for-tuple-attributes/1072/2