Fork me on GitHub
#datomic
<
2015-09-22
>
stuartsierra12:09:38

Does DynamoDB promise five nines?

sonnyto15:09:59

is it possible to query across two databases? for example:

sonnyto15:09:02

(def r2 (d/q '[:find ?e :in $ $1 :where (or [$ ?e :artwork/title _] [$1 ?e :artwork/title _])] [[123 :artwork/title "foo"]] [[1234 :artwork/title "bar"]]))

sonnyto15:09:34

i would like to get all entities with :artwork/title in both database value

sonnyto15:09:42

but the query returns empty

bostonaholic15:09:35

@sonnyto: I assume you are passing both dbs to d/q

bostonaholic15:09:42

your example is missing them

sonnyto15:09:14

the dbs are [[123 :artwork/title "foo"]] [[1234 :artwork/title "bar"]]

bostonaholic15:09:31

ah, missed that

sonnyto15:09:13

apparently rules cannot take db as arguments

sonnyto15:09:21

is there another way to do this?

marshall16:09:13

@sonnyto: You can use separate logic variables for each source:

(d/q '[:find ?e1 ?e2 :in $ $a :where [$ ?e1 :artwork/title _] [$a ?e2 :artwork/title _ ]] d1 d2) 

sonnyto16:09:06

that seems to work.. thanks! i'll play around with it

marshall16:09:12

You might end up having to deal with cartesian product there

bkamphaus18:09:03

@sonnyto: I would be cautious about using that solution - be sure you’re ok with the intermediate rep’s size (since it’s the cartesian product, the relation will return an intermediate set of n * m instead of n + m, which you’ll presumably be flattening out anyways). If you’re on the JVM, I’d just write two queries and merge the sets (you don’t have the same impetus to tackle everything in one query as in SQL w/Datomic due to local caching/peer direct read access to storage).

bkamphaus18:09:00

I’m also assuming here that your toy query example isn’t illustrative of your use (i.e., getting entity id’s), as if you’ll be using the entity id’s elsewhere you’d probably want to know which db/source they’re from.

sonnyto18:09:04

Thanks @bkamphaus yes. It's a toy example to understand how to work with multie db vals

bkamphaus18:09:36

(another picky point, w/apologies to @marshall , is that the query is not particularly evident - I would have to do a little bit of guesswork to figure you’re hacking a merge w/a find specification that returns a relation that is not really a meaningful relation).

marshall18:09:01

no apologies necessary. it was very much a hack.

danielcompton20:09:05

@stuartsierra: I did some research, and doesn’t look like there is a published SLA. Guess you can’t just trust what you see on Twitter 😞