Fork me on GitHub
#datomic
<
2017-02-27
>
beppu01:02:34

> Datomic Pro is issued with a perpetual license, with ongoing maintenance fees of $5,000 per year per system. (source: http://www.datomic.com/get-datomic.html) What is the definition of "system" in this context?

robert-stuttaford05:02:51

@sova

(let [db (d/db conn)
      blurb-ids  (d/q '[:find [?blurb ...] :in $ :where
                        [?blurb :blurb/attr-only-asserted-when-created]]
                      (d/since db #inst "24 hours ago"))]
  (d/pull-many db '[*] blurb-ids))

robert-stuttaford05:02:37

no need to use d/log at all. just query a database that only has datoms from the period you care about.

robert-stuttaford05:02:06

you don’t need to use datalog either:

(->> :blurb/attr-only-asserted-when-created
     (d/datoms (d/since db #inst "24 hours ago") :aevt)
     seq
     (map :e)
     (d/pull-many db '[*])

robert-stuttaford05:02:36

note that we only use the time-constrained database for the initial seek; the ‘now’ db for the rest, because you may want to query for things asserted in the past (e.g. relationships to previously existing entities, like author etc)

thedavidmeister08:02:22

potentially dumb question, but how would i construct a :where so that i can pass a sequence of potential values something can match?

thedavidmeister08:02:29

e.g. a list of entity ids

misha08:02:49

@thedavidmeister

(q '[:find [?e ...] :in $ [?x ...] :where [?e :foo/bar ?x]]
  db xs)

misha08:02:44

[?x ...] instead of just ?x

thedavidmeister08:02:57

kk 1 sec, i'll try that out 🙂

thedavidmeister08:02:14

so is ... some clojure syntax i haven't learned yet?

misha08:02:31

it is a part of a query grammar

thedavidmeister08:02:48

ah ok, so specific to datomic?

misha08:02:45

I'd say yes

thedavidmeister08:02:52

cool, makes sense

thedavidmeister08:02:06

not sure why i couldn't find this before

thedavidmeister08:02:15

probably putting the wrong words into google 😛

misha08:02:43

datomic documentation is a good read

thedavidmeister08:02:22

tbh i've read over it a few times on different occassions, but it sinks in better when i have a real problem to solve

robert-stuttaford09:02:09

@thedavidmeister a slow, careful read of http://docs.datomic.com/query.html will save you a lot of time

marshall14:02:48

@beppu A single production transactor + all associated peers and clients

sova-soars-the-sora16:02:27

@robert-stuttaford Beautiful. Thank you kindly. So the first step asks the query over a specific time-constrained db, and the second uses that info against the Now version to get all the good stuff, if I'm understanding correctly.

dm320:02:21

@marshall that still covers several transactors working in a HA setup, right?

marshall20:02:00

Yes. single production transactor You can, of course, also have an HA transactor for that prod system and as many dev/staging/testing instances as you require

jfntn22:02:35

Is it possible with datomic/q to “map” a pull expression over multiple entities in a single query?

favila22:02:28

there is also d/pull-many for use outside queries

favila22:02:42

(I am not sure why this exists vs just d/pull with map. Maybe it can be more efficient?)

dominicm22:02:52

favila: significantly more efficient ime

favila22:02:03

Also not documented for some reason is that the pull find expression can take a database, (pull $ ?e [:pull-expr])

jfntn22:02:35

Ok that worked, thank you @favila

jfntn22:02:32

Since you mentioned it, I don't understand the need for the explicit db binding in declarative queries?

favila22:02:54

if you have more than one database @jfntn

favila22:02:22

@jfntn Example: (d/q '[:find [(pull $b ?e [*]) ...] :in $a $b :where [$a _ :some-attr ?e-id][$b ?e :id-attr ?e-id]] db-a db-b)