This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-05-03
Channels
- # boot-dev (1)
- # cider (27)
- # cljsjs (6)
- # cljsrn (11)
- # clojure (249)
- # clojure-dusseldorf (1)
- # clojure-finland (1)
- # clojure-greece (1)
- # clojure-italy (28)
- # clojure-nl (12)
- # clojure-russia (2)
- # clojure-spec (5)
- # clojure-uk (27)
- # clojurescript (24)
- # clojutre (2)
- # component (8)
- # cryogen (1)
- # cursive (7)
- # datomic (61)
- # editors (18)
- # emacs (1)
- # events (1)
- # figwheel (4)
- # fulcro (35)
- # graphql (4)
- # jobs (3)
- # jobs-rus (1)
- # keechma (1)
- # leiningen (1)
- # london-clojurians (1)
- # luminus (62)
- # off-topic (154)
- # onyx (23)
- # pedestal (43)
- # portkey (66)
- # re-frame (49)
- # reagent (23)
- # shadow-cljs (92)
- # tools-deps (113)
- # uncomplicate (2)
How do you reference the current transact? Is it just adding a tempid?
I’m trying to add some auditing to my db and I’ve been looking at this -> https://blog.clubhouse.io/auditing-with-reified-transactions-in-datomic-f1ea30610285.
They use (d/tempid :db.part/tx)
, is that just creating a tempid to the transaction id
in the same way that an tempid references an entity id
?
https://docs.datomic.com/cloud/transactions/transaction-processing.html#reified-transactions may help
So further reading leads me to -> https://docs.datomic.com/cloud/best.html#add-facts-about-transaction-entity.
It seems that "datomic.tx"
is the txid for the current transaction?
hey what does it mean when I get
:cognitect.anomalies/busy
when I do a multi-database query on 2 dbs, but when I query each separately it works ?I frequently do this: [?eid1 :foo/bar ?value] [?eid2 :foo/bar ?value] [(!= ?eid1 ?eid2)]
. This seems like two passes on the index (I imagine). Is there a better way to do that?
I have a question around transactor function guarantees — we have a unique v attribute
{:db/ident :foo/id
:db/valueType :db.type/string
:db/cardinality :db.cardinality/one
:db/unique :db.unique/value}
and we set this id in a transactor function
(fn [db eid]
(let [n (->> (d/datoms db :avet :foo/id (str "foo" 1))
(take-while (fn [[e a v t]]
(.startsWith ^String v "foo")))
(count)
(inc))]
[[:db/add eid :foo/id (str "foo" n)]]))
in testing we sometimes get
:db.error/unique-conflict Unique conflict: :foo/id, value: foo2 already held by: 17592213012316 asserted for: 17592213017846
I’m not sure how to reason about this — could be a bug in my code, or is datoms not supported inside a tx function? the index is eventually consistent?
(“foo” is actually an argument to the function for full disclosure — we prefix the auto-inc ids)
I’m doubtful tho as the previous version of the tx function didn’t use datoms but a query of all :foo/id
so would hit the same bug and has never hit it 😜
shouldn’t it be d/seek-datoms ?
@robert-stuttaford checking docs 🙂
https://docs.datomic.com/on-prem/clojure/index.html#datomic.api/seek-datoms
that makes a lot of sense … I was surprised when (d/datoms db :avet :foo/id "foo")
returned nothing
thanks @favila / @robert-stuttaford!
if there's no assertions for foo/id at all it will just be empty, not the next attribute
I read this from the docs “The index is updated periodically in the background and contains datoms sorted in various orders.” and was like “this can’t be true for the client API” but was now questioning my life
@eraserhd I'm pretty sure what you are doing is a true cross join--you really do need to visit every index segment to self-join
Ah, but if you are binding two variables in the first clause, there's no way to tell Datomic which way to do it. e.g. seek on eavt, bind v, seek on avet, bind e. Hmm.