This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-02-09
Channels
- # beginners (55)
- # boot (173)
- # clara (3)
- # cljs-dev (10)
- # cljsjs (3)
- # clojars (11)
- # clojure (110)
- # clojure-austin (5)
- # clojure-berlin (13)
- # clojure-chicago (2)
- # clojure-dusseldorf (3)
- # clojure-france (24)
- # clojure-italy (4)
- # clojure-portugal (1)
- # clojure-russia (60)
- # clojure-serbia (8)
- # clojure-spec (150)
- # clojure-uk (129)
- # clojurescript (87)
- # core-logic (1)
- # cursive (75)
- # datavis (1)
- # datomic (75)
- # devcards (4)
- # dirac (17)
- # emacs (50)
- # events (2)
- # hoplon (9)
- # jobs (4)
- # jobs-discuss (37)
- # lein-figwheel (3)
- # luminus (5)
- # off-topic (54)
- # om (9)
- # om-next (5)
- # onyx (10)
- # perun (11)
- # protorepl (11)
- # quil (2)
- # rdf (2)
- # re-frame (14)
- # reagent (58)
- # ring (13)
- # ring-swagger (10)
- # rum (52)
- # spacemacs (8)
- # test-check (10)
- # untangled (17)
- # yada (34)
can someone point me to docs explaining the new tempid
behavior?
specifically, I'm trying to figure out which values are allowed in :db/id
when annotating transactions
oops, after 30 min looking for it, writing here is what made me find it 🙂 http://docs.datomic.com/transactions.html#outline-container-2-1-1
(try
(d/q
'[:find ?e
:in $ ?some
:where [?some :other/attr ?e]]
db
[:some/id (d/squuid)])
(catch Exception e
(some-> e .getCause .getCause .getMessage (.startsWith "Cannot resolve key"))))
Anyone come across the following error before?
java.util.concurrent.ExecutionException: java.lang.RuntimeException: java.lang.RuntimeException: Can't let qualified name: db/id, compiling:(NO_SOURCE_PATH:0:0)
at datomic.promise$throw_executionexception_if_throwable.invoke(promise.clj:10)
at datomic.promise$settable_future$reify__6755.deref(promise.clj:54)
at clojure.core$deref.invokeStatic(core.clj:2228)
at clojure.core$deref.invoke(core.clj:2214)
I'm not using db/id
in my code anywhere. This is inside a Manifold deferred BTW.@favila couldn't it be a {:keys [db/id]}
destructuring ?
@val_waeselynck that would make sense if it were in a macro.
@val_waeselynck ah, it could be, but on an older clojure
yeah that's what I was thinking
But I'm not doing
(defmacro blah []
`(let [{:keys [db/id]} (d/transact conn ...)))
anywhere.search Datomic's source code... oh wait, you can't.
(if (seq txes)
(let [{:keys [db-after]} @(datomic/transact datomic txes)]
;; ...
(datomic/entity datomic db-after (:db/id task)))
;; ...
)
It's something like that with irrelevant bits removed. I'll sniff around the txes to make sure they're valid.
[{:db/id 17592186045447, :task/state :task.state/failed,
:task/next-run #inst "2017-02-10T17:09:02.353-00:00"}
[:inc-attr 17592186045447 :task/retries]]
{:db/id #db/id [:db.part/user]
:db/ident :inc-attr
:db/fn #db/fn
{:lang "clojure"
:params [db lookup-ref attr]
:code
(let [{:keys [db/id] :as ent} (d/entity db lookup-ref)]
[[:db/add id attr (-> ent (get attr 0) inc)]])}}
@jcf does it work when you run the function locally ?
(e.g in a d/with
)
@val_waeselynck I have a couple of tests that use the function, but with an in-memory database.
@jcf and so, do those work ?
or do they throw the error
ok that narrows the scope
I'm guessing either the transactor runs an older version of Clojure, or there's a problem in the serialization of the function code
Just written this test, and it passes:
(deftest ^:integration t-inc-attr
(t/with-system [{:keys [datomic]} (test.datomic/new-datomic-system)]
(let [db (sut/db datomic)]
(is (= [[:db/add 17592186045447 :task/retries 1]]
(d/invoke db :inc-attr db 17592186045447 :task/retries))))))
I'll double check the version of Clojure on the transactor, but pretty sure it'll be the same everywhere.
@jcf does it work if you rewrie the function to not use destructuring ?
@val_waeselynck let's see…
Strange. We must not be running the version of Clojure I thought, or maybe there's a bug fix we're missing.
@jcf you can write a transaction function which returns the current Clojure version (in an exception)
I mean the one running in the Transactor.
That's one way to do it. I checked the transaction-pom.xml and found Clojure 1.6. I've recommended an upgrade.
are you using a very old transactor? or including jars on the transactor's classpath which may overwrite the clojure libs?
What's the right way in Datalog to express that the set of all values bound to a given variable must be equal to the set of all the values bound to another variable?
There was a great talk on this by Stuart Halloway at the Clojure Conj last fall