This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-09-20
Channels
- # announcements (16)
- # aws (1)
- # babashka (24)
- # beginners (54)
- # calva (25)
- # cider (4)
- # cljs-dev (2)
- # clojure (16)
- # clojure-dev (39)
- # clojure-europe (18)
- # clojure-nl (1)
- # clojure-uk (4)
- # clojurescript (66)
- # core-async (16)
- # cursive (13)
- # datomic (15)
- # deps-new (1)
- # duct (22)
- # fulcro (20)
- # jobs-discuss (1)
- # kaocha (3)
- # lsp (11)
- # malli (8)
- # off-topic (38)
- # other-languages (18)
- # polylith (18)
- # portal (15)
- # react (2)
- # reagent (9)
- # reitit (7)
- # releases (10)
- # reveal (1)
- # sci (13)
- # shadow-cljs (3)
- # specter (4)
- # sql (4)
- # xtdb (16)
Hello. I have a noob problem but I'm not really having luck reading the documentation: I just want to pull all the datoms of a transation. How do I do that?
Today I'm doing:
(d/q '[:find ?pl ?v ?added
:in $ ?tx
:where
[?pl :purchase-line/quantity-received ?v ?tx ?added]]
(d/history db) transaction-id)
and it's terribly inneficient (like 20s).so; there is no index on t (or tx). Running this query, datomic has no choice but to use AEVT or AVET indices. Effectively walking through the index for that attr, for each point in time.
since you bind ?tx
in your in, consider using (d/as-of db transaction-id)
or otherwise, you can probably also use d/tx-range
to get that specific transaction from the log
Does that make sense?
How to retract mistakenly added :db/ident
?
E.g. i added such a transaction by mistake:
(d/transact conn {:tx-data [{:db/ident :release.type/album :release.type/name "Album"}]})
How to retract it so :release.type/album is not longer available in the latest db:
(d/q '[:find ?e :where [?e :db/ident :release.type/album]] db) ;; => ()
You can use :db/retractEntity
: https://docs.datomic.com/on-prem/transactions/transaction-functions.html#dbfn-retractentity
trying to understand the difference between lookup refs and unique identity (reading https://docs.datomic.com/on-prem/schema/identity.html#lookup-refs), is there a difference between upserting
{:person/email ""
:person/loves :pizza}
versus
{:db/id [:person/email ""]
:person/loves :pizza}
?I think the second will raise when
is not in your db
Yeah it does, so the first is a proper upsert, the second can only update