datomic

Alex 2025-06-06T11:23:44.188649Z

Hi! Is it possible to define and transact a unique composite tuple attribute at the same time as the individual attributes it depends on? I’m getting this error when I try to do that:

{:cognitect.anomalies/category :cognitect.anomalies/incorrect, :cognitect.anomalies/message First error: :db.error/invalid-tuple-attrs, :db/errors (#:db{:error :db.error/invalid-tuple-attrs, :tupleAttrs [:transaction/company :transaction/integration-id]}), :db/error :db.error/invalid-install-attribute}
It works just fine if I transact the individual attributes first, and then add the tuple attribute in a separate transaction. Is that expected behaviour?😅 I didn’t notice any info about this in https://docs.datomic.com/schema/schema-reference.html#composite-tuples. P.S. Datomic Pro

favila 2025-06-06T12:10:39.703799Z

Yes you must transact first. This is a consequence of its transaction model https://docs.datomic.com/transactions/model.html#with-and-transact

👍 1
👀 1
👌 1
favila 2025-06-06T12:13:09.861919Z

There are no visible intra-transaction states, which is what you would need for composite attr installed in same tx as its components to work

Alex 2025-06-06T12:14:58.242299Z

Noticed https://clojurians.slack.com/archives/C03RZMDSH/p1748530799030919 about composite tuple, looks interesting=) Probably next time I will use heterogeneous tuple:sweat_smile:🤔

🆒 1