Fork me on GitHub
#datomic
<
2020-05-03
>
Ben Hammond08:05:59

Morning I'm trying to introduce an 'or' clause into a (cloud) datomic query, but I'm seeing a

Execution error (ExceptionInfo) at datomic.client.api.async/ares (async.clj:58).
Nil or missing data source. Did you forget to pass a database argument?
error. So this query works as expected
(datomic.client.api/q
  {:query '[:find (pull ?e [*])
            :in $u [?uid ...]
            :where [$u ?e :game/red-player ?uid]]
   :args [(dca/db datomic-game-conn)
          [#uuid "c5658831-892e-4c67-b87e-d39a5a6a5660"]]} )
but this gives me an error 'or' clause introduced in the where
(datomic.client.api/q 
  {:query '[:find (pull ?e [*])
            :in $u [?uid ...]
            :where (or [$u ?e :game/red-player ?uid])]
   :args [(dca/db datomic-game-conn)
          [#uuid "c5658831-892e-4c67-b87e-d39a5a6a5660"]]} )
Execution error (ExceptionInfo) at datomic.client.api.async/ares (async.clj:58).
Nil or missing data source. Did you forget to pass a database argument?
what am I doing wrongly?

Ben Hammond08:05:46

oh I think it works if I replace named database` $u with *anonymous database $

Ben Hammond09:05:11

perhaps its the datomic-queries-across-multiple db angel Tthat I'm having problems with

Ben Hammond09:05:01

are multi-cloud--database queries be possible when using datomic cloud? is it just or clauses that are a problem?

favila19:05:32

Rules (of which or is a kind of anonymous rule) can only operate on one db

favila19:05:59

They have a different syntax for rebounding the db: put it before the rule invocation

favila19:05:34

(datomic.client.api/q 
  {:query '[:find (pull ?e [*])
            :in $u [?uid ...]
            :where ($u or [?e :game/red-player ?uid])]
   :args [(dca/db datomic-game-conn)
          [#uuid "c5658831-892e-4c67-b87e-d39a5a6a5660"]])

👍 4
favila19:05:07

So every clause must use $u and you can not override

favila19:05:28

(No cross-datasource joins allowed in rules)

Ben Hammond20:05:53

I never would have guessed that syntax; is it in the docs anywhere?

Ben Hammond20:05:57

ah but your point is that there is no benefit in specifying the datasource as $u because There Can Be Only One so I may as well leave it implicit and get on with my life

favila22:05:38

That wasn’t really my point. It was that rules have this data source limitation so they have a special syntax

👍 4
favila22:05:57

Yes this is documented

favila22:05:42

It’s called src-var in the grammar

👍 4
Sam DeSota20:05:22

The ion docs recommend using ion/get-params, but get-params breaks after 10 params

Sam DeSota20:05:00

Can't this break production deployments if all you do is add too many params to param store? This seems like it needs to be fixed.

Sam DeSota20:05:03

Since we have no control over when an ion restarts, it could happen without a deploy and rollbacks could fail.

Sam DeSota21:05:30

I've fixed in my own deployment by paging and partitioning