Fork me on GitHub
#datomic
<
2021-04-28
>
danieroux09:04:45

What is the simplest way to have cronjobs functionality on Datomic Cloud?

tatut09:04:39

idk about simplest, but we’ve used cloudwatch cron events to trigger an ion lambda

danieroux10:04:58

Ah, did not know cloudwatch had that. And, of course, would prefer something not-in-AWS.

tatut10:04:00

datomic cloud is always in aws

tatut10:04:50

it is easier to control the cron job than to build some threads that are run on all nodes of the compute group, but ymmv

danieroux11:04:49

I am definitely not syncing threads across all nodes, that seems like an invitation to screw up! I’ll give in to cloudwatch and triggering ions, thank you

ivana15:04:10

Hello. How I can get it work? I got Assert failed: All clauses in 'or' must use same set of vars, had [#{?email ?e} #{?phone ?e}]

[:find ?e
 :in $ ?email ?phone ?id
 :where
 (or [?e :worker/email ?email]
     [?e :worker/phone ?phone])
 (not [?e :worker/id ?id])]

favila16:04:12

nm, didn’t read carefully

ivana16:04:39

This way seems to be working

[:find ?e
 :in $ ?email ?phone ?id
 :where
 (or-join [?e ?email ?phone]
          [?e :worker/email ?email]
          [?e :worker/phone ?phone])
 (not [?e :worker/id ?id])]

ivana16:04:53

As much as I tested it

favila16:04:12

yes that is correct.

ivana16:04:57

The reason was cause of input parameters but not values?

favila16:04:26

All “branches/implemenations” of a rule must have the same bindings. If you don’t specify bindings the parser infers them from whatever bindings it sees in each branch. If they don’t match, you get that warning

ivana16:04:28

If I set values in place of input arguments it works with or also

favila16:04:22

or-join (and all -join variants) say explicitly what bindings there are. implementations that don’t use a binding will just not unify against it, which is what you want here

favila16:04:54

you want one implementation to unify against email and ignore phone, and the other to do the opposite

favila16:04:13

and the results from both are set-unioned

ivana16:04:10

Thanks, seems that I meeting this case regulary and forget the rules every time after )

favila16:04:58

It helps me to think of or* and and* as just syntax sugar for rules, and think about the rule I would write

ivana16:04:07

Thanks again, I'l try to rethink my mental model of it

favila16:04:40

e.g. this would be [[(worker-phone-or-email ?e ?phone ?email) [?e :worker/email ?email]]…] Saying (worker-phone-or-email ?e ?phone) for one impl and (worker-phone-or-email ?e ?email) for the other would be more obviously wrong

ivana16:04:01

maybe I'l just rewrite query to use direct values instead of input parameters, cause I still dont understand this -join magic perfectly

ivana16:04:51

Working with Clojure is much understandable than with datomic )

ivana15:04:55

While docs example uses also different set but it works

[:find (count ?artist) .
 :where (or [?artist :artist/type :artist.type/group]
            (and [?artist :artist/type :artist.type/person]
                 [?artist :artist/gender :artist.gender/female]))]