This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-07-29
Channels
- # admin-announcements (2)
- # beginners (10)
- # boot (253)
- # cider (11)
- # cljs-dev (26)
- # cljsjs (21)
- # cljsrn (7)
- # clojure (87)
- # clojure-berlin (13)
- # clojure-dusseldorf (5)
- # clojure-greece (7)
- # clojure-poland (11)
- # clojure-russia (189)
- # clojure-spec (31)
- # clojure-uk (86)
- # clojurescript (89)
- # cursive (15)
- # datavis (2)
- # datomic (57)
- # devcards (3)
- # dirac (92)
- # editors-rus (3)
- # emacs (4)
- # events (1)
- # funcool (30)
- # hoplon (3)
- # jobs-rus (6)
- # leiningen (1)
- # luminus (12)
- # mount (25)
- # off-topic (5)
- # om (43)
- # onyx (41)
- # perun (1)
- # proton (2)
- # protorepl (7)
- # re-frame (17)
- # reagent (34)
- # ring (13)
- # specter (1)
- # spirituality-ethics (1)
The database function docs are kinda sketch on how one tx function can call another tx function. Is that possible, even?
is there a way to efficiently read through all datoms within a given partition? I'm thinking of using indexRange and the EAVT index. But don't know how to specify the lower and upper bound. Can i somehow find out what the lowest and highest entId is for a given partition?
@cezar: I'd question why you want to do something like that. This should do what you want though.
(d/datoms (d/filter db (fn [_ ^Datom datom]
(->> datom .e d/part (= part)))) :eavt)
what you showed is a sequential scan over the whole database. If I have a 1000 customers and each in its own partition and I want to trawl through a reasonably large collection of datoms (say 10,000,000 for each customer) it will be way more efficient to hone in only on the section of the index where their specific data is located. Isn't that what partitions are for?
queries are very eager and I find that running d/q where the result is more than about 5,000,000 entities can easily blow up a Peer with OOM even on a Peer with Xmx4g
The locality of reference is in :eavt
, you could take-while
with a pred on part
- http://docs.datomic.com/clojure/#datomic.api/part — starting from the beginning of the partition with seek-datoms
— http://docs.datomic.com/clojure/#datomic.api/seek-datoms
thanks @bkamphaus for pointing me in the right direction
I can simply look use entIdAt with Date 0 and Date now to get all entities over a given partition
How do you lookup a database function so that you can call it from within another database function?
I ask because I find myself wanting to (mapcat (fn [x] [:my/fn db a b c])
values) which seems, odd? Hm. Maybe it’ll work.
Ha! It works! My tx function is huge with multiple functions, but I don’t think there’s much else I can do when updating a complicated “document-like” structure.
hi guys how do I avoid transacted value being printed to *out*
in repl ? I import quite big amount of data and it's annoying.
@bkamphaus: I'm having a doubt about how Datomic works: are the indexes persisted in storage are immutable trees of segments, or is this just the in-memory representation?
in storage too
i usually do (-> (d/transact ...) :db-after)
or ( .. :tx-data count)
@val_waeselynck: it’s turtles all the way down.
@zentrope: Yes, you can call txn functions from other txn functions. As long as they all eventually resolve to valid txdata (i.e. list of datoms)
@cezar: Yep, as you found (and @bkamphaus indicated), the most significant bits of the entity ID encode the partition. Thus, the partition is contiguous in EAVT index.
> it’s turtles all the way down. @marshall: sorry, I don't know what that means 😕 (not a native English Speaker)
@val_waeselynck: Sorry. Yes, it’s immutable segments everywhere.
@marshall: thanks! 🙂
@val_waeselynck: As an english speaker, I do not understand either.
@marshall: Yes, it all makes sense if you think of a TX function as producing a data structure. Kinda like a macro.
3) The example command to start the console here http://docs.datomic.com/console.html:
bin/console -p 8080 dev datomic:
Has 2 port designations 8080 and 4334. I get that the web app that is the console is then available on 8080, but what is running or available on 4334? Do I need to start a transactor in a local dev environment on 4334? I think I read somewhere that I don’t, but it’s not clear from the explanation on this web page.There is an example dev-transactor.properties file in the Datomic Pro distribution under config/samples
if you’re using free, there is a free-transactor-template.properties file in config/samples
Thanks @marshall. When do I need to specify the transactor.properties file in a command? Do I need to start a transactor in a local dev environment?
@nando you want to specify the file when you launch your transactor. Yes, you will need to start a transactor in a local dev env.
http://docs.datomic.com/console.html jumps into explaining how to start the console without mentioning that you need a transactor running
@nando The getting started section is where I went first. I didn’t make my way into the overview section until after the tutorial.
Using the pull api: Is there a way to turn {:foo {:id “1234”}}
to {:foo “1234”}
without doing any post processing?
If I want to use an aggregate result to track down another value on an entity, will I always need to use two queries?
(defn last-edited [conn eid]
(d/q '[:find (max ?inst)
:in $ ?e
:where
[?e _ _ ?tx _]
[?tx :db/txInstant ?inst]]
(d/db conn) eid))
;;(the following is not what I want because “Query variables not in aggregate expressions will group the results and appear intact in the result.”)
(defn last-edited [conn eid]
(d/q '[:find (max ?inst) ?user
:in $ ?e
:where
[?e _ _ ?tx _]
[?tx :db/txInstant ?inst]
[?tx :user/source ?user]]
(d/db conn) eid))