This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-08-07
Channels
- # beginners (95)
- # cider (131)
- # cljdoc (12)
- # cljsjs (2)
- # clojure (209)
- # clojure-dev (1)
- # clojure-italy (3)
- # clojure-nl (10)
- # clojure-russia (37)
- # clojure-spec (19)
- # clojure-uk (182)
- # clojurescript (136)
- # cursive (28)
- # datomic (28)
- # editors (55)
- # figwheel-main (1)
- # fulcro (36)
- # hyperfiddle (12)
- # jobs (1)
- # jobs-discuss (55)
- # luminus (1)
- # mount (1)
- # off-topic (28)
- # onyx (18)
- # reagent (17)
- # ring-swagger (4)
- # rum (14)
- # shadow-cljs (22)
- # spacemacs (15)
- # tools-deps (16)
- # vim (26)
What's a good way to reset the database to a known state for integration testing for an Ions app? Thinking it through I could use (do (delete-database...) (create-database ...) (transact fixtures ...))
. I wondered if there was something like a (clone-database ...)
or (reset-db-to tx-id)
which might simplify restoring to a known state. Clearly this is somewhat at odds with providing an immutable db.
I use the datomock lib. it makes a big difference in speed when integration testing. only works with peer/mem db. it’s one option that works for me
Yeah. Something like that for cloud would be useful.
I found a way to have both. You can proxy the client conn/db and use mem underneath. then you can use datomock with client/cloud code.
I’ve been discussing Datomic with my CTO and his biggest fear is Cognitect being a relatively small company combined with the closed source nature of Datomic. Is there any documentation that tries to address this kind of fear? Is there way to get the data out in a usable form? Can we sign a source code access agreement?
Datomic sales would be the best people to talk to about all that <mailto:[email protected]|[email protected]>
Thanks @alexmiller
In some of the examples on Github, I see that the client and connections are memoized as such:
(def get-client
(memoize #(d/client
{:server-type :ion
:region "us-east-1"
:system "stu-8"
:query-group "stu-8"
:endpoint " "
:proxy-port 8182})))
(def get-http-client (memoize #(http/create {})))
(def db-name "ion-event-example")
(def get-conn (memoize #(d/connect (get-client) {:db-name db-name})))
Is memoizing the call to d/client ok to do in general, or is this just something
that was done for development purposes?
Likewise, would one want to memoize the call to d/connect?“Datomic connections do not adhere to an acquire/use/release pattern. They are thread-safe and long lived. Connections are cached such that calling datomic.api/connect multiple times with the same database value will return the same connection object.”
I find myself building up a lot of tx maps with (merge m (when x {:attr-x x}) (when y {:attr-y y}))
… this must be a common datomic pattern? how do y’all normally handle that idiomatically?
@curtosis I find myself using this pattern quite a bit as well. I personally prefer using:
(cond-> {}
x (assoc :attr-x x)
y (assoc :attr-y y))
over merge, but it seems like it’s essentially the same. I’ve also created some macros in the past to expand this for me, if I’m able to extract a common patterncond-> both reads better and is faster so definitely preferred
ok, now a definitely datomic-related question… I’m using the “best practice” asyc tx-pipeline
and sometimes I’ll get no actual elements transacted, even though the batch looks fine.
ordinarily I’d asssume they were already-asserted items, but I don’t see them in the datomic console