This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2024-02-15
Channels
- # announcements (1)
- # babashka (1)
- # beginners (43)
- # cider (2)
- # clj-kondo (29)
- # clojure (61)
- # clojure-austin (18)
- # clojure-dev (7)
- # clojure-europe (30)
- # clojure-nl (1)
- # clojure-norway (23)
- # clojure-uk (5)
- # clojuredesign-podcast (8)
- # cloverage (1)
- # conjure (1)
- # data-science (1)
- # datahike (36)
- # datavis (1)
- # datomic (23)
- # emacs (14)
- # hyperfiddle (28)
- # lsp (5)
- # missionary (1)
- # music (1)
- # off-topic (11)
- # re-frame (11)
- # reitit (5)
- # releases (1)
- # shadow-cljs (65)
- # spacemacs (13)
- # squint (33)
- # tools-deps (56)
Found a broken link at: https://docs.datomic.com/pro/clojure/index.html#datomic.api/pull-many Link should go to: https://docs.datomic.com/pro/query/pull.html Screenshot below:
I've been exploring entity specs for my application and I was surprised to see the "virtual" :db/ensure
attribute appear when pulling "spec'd" entities. This is so counter-intuitive I wonder if I'm doing something wrong.
The docs (https://docs.datomic.com/cloud/schema/schema-reference.html#entity-specs) clearly state that:
• :db/ensure
is a virtual attribute
• it is not added to the database
But after transacting the initial assertions of my domain entity with :db/ensure, I subsequently see a ref attribute on the entity:
(d/pull db '[*] 101155069759907)
=>
{:db/id 101155069759907,
:db/ensure [#:db{:id 87960930222306, :ident :st.data-source/valid?}],
:st.data-source/id #uuid "0dcff1a1-3785-45c2-846f-de72401ba810",
:st.data-source/credentials #:db{:id 101155069759908},
:st.data-source/type :st.data-source.type/tesla}
The referenced entity is in fact the entity I had previously transacted into my schema to support the "named" ensure:
{:db/ident :st.data-source/valid?
:db.entity/attrs [:st.data-source/id :st.data-source/type]}
First: thanks for the confirmation. I thought I was going crazy. Second, any idea of a work-around?
It seems like Datomic is not recognizing the :db/ensure
attribute as "special" and is instead creating a reference with that name.
ok, my experience is it definitely does whatever assertions it’s supposed to do, it just happens to be written into the db
If it's written, that begs the question: is the opt-in permanent since the attr is permanent?
The only oddity is that the :db/add is eventually materialized as a datom instead of being stripped, and that’s only odd because they said it wouldn’t be