datomic 2025-09-19

Hello 👋 Is it possible to create a d/q query to check that a vector of entities has certain attribute? Something like this, but instead using a vector of ent ids

(d/q '[:find ?e
       :in $ ?e
       :where [?e :some/attr true]]
     db 17592186734126)

:in $ [?e ...] then pass in a vector of entity ids.

Right, that way I can get a list of entities that match the attribute. But I'd like to return a truthy value only if every entity has the attribute

Compare count of input vs result. If equal, everything matches

yep, that seems the basic solution

(Assuming input items are distinct)

@joe.lane (referencing https://clojurians.slack.com/archives/C03RZMDSH/p1747391001328559?thread_ts=1747385971.572309&cid=C03RZMDSHfrom yours earlier this year ) Do you have any more info about this pattern you could share? I'm particular curious about the details. In particular your use of the term "time shard", I didn't think datomic supported sharding (or we mean different things?). Also AFAIK the latest advice for Pro is that you shouldn't really be running more than one actively-being-written-to database per transactor. I am particularly interested in "sidecar" databases to store queue/job data, ephemeral otp like data etc.

👀 3
👆 2