Fork me on GitHub
#datomic
<
2018-11-19
>
Vincent Cantin00:11:18

Could you show the expression that causes this exception? I guess that the parameters are not at the right place in your function call, w.r.t. your query.

kenny01:11:27

This is the query that causes it.

(d/q '[:find ?cust-id
       :in $ ?metric
       :where
       [?metric :metric/integration ?integration]
       [?customer :customer/integrations ?integration]
       [?customer :entity/id ?cust-id]] db [:entity/id metric-id])

gordon04:11:05

@kenny is it possible that metric-id is bound to a database value instead? (e.g. swapped function args during a refactor)

kenny18:11:12

@gws I don't think so. I tried it locally and the exception is different.

đź‘Ť 4
kenny21:11:09

I'm pretty sure the above exception is due to a bug in Datomic related to require not being thread safe.

marshall21:11:56

@kenny is this in an ion or a client app?

kenny22:11:04

Client app

joshmiller23:11:39

If I have user-groups with many users, and a user has a boolean attribute like :user/activated, how can I compose a query to find just user groups where all users have that attribute true? Something like [:find ?group :where [?group :user-group/users ?u] [?u :user/activated true]] just finds me groups with at least one activated user. I’ve tried using (not ...) and looked for some kind of all predicate without any success.

joshmiller23:11:09

I can get the desired effect with (count-distinct ?activated) and filtering out groups with counts of 2, but that doesn’t seem like a great solution.

marshall23:11:19

or do they all have the attr. but it’s set to false?

joshmiller23:11:37

Yeah, it’s set for all, but some are true and some are false.

marshall23:11:25

i’d have to poke at it a bit, but i think you can use a :with grouping https://docs.datomic.com/cloud/query/query-data-reference.html#with

marshall23:11:01

which will get you the “bag not set” of values that you can then do an aggregation on

marshall23:11:15

it might be something better handled with a rule or a query function, though

joshmiller23:11:58

Cool, I’ll take a look at :with

marshall23:11:24

You may have to do nested queries using with

joshmiller23:11:29

I tried not-join without any success, via something like: (not-join [?group ?user] [?user :user/activated false]) but that didn’t do it for me

marshall23:11:23

Yeah, I'd have to work thru it but I'm on my cell right now :)

joshmiller23:11:32

No worries, thanks for the leads