asami

Jakub Holý (HolyJak) 2022-04-10T17:32:44.125479Z

This does not work:

(d/transact conn {:tx-data [{:id [:person/id "person2"]}
                            [:db/add [:id [:person/id "person2"]] :person/full-name "Bob"]]})
(It will create one entity with :id and :a/node-<num> b/ident and another one with db/ident [:id [:person/id "person2"]] .) I guess it is due to what https://clojurians.slack.com/archives/C018H97E02D/p1648752474852009?thread_ts=1648748922.963539&amp;cid=C018H97E02D > You're creating an entity [...] you try to reference it with: [:id ...] That tells the transactor to look up a node that has that as an id. But... there IS no node that has that as an ID. You're still creating it, so it doesn't exist yet. It won't exist until the end of the transaction I.e. I cannot combine entities and triplets and I must insert all the data as single entity map. Is that correct? And should this ☝️ be eventually supported? Thank you!!!

quoll 2022-04-10T17:37:04.056199Z

I don't actually follow what’s going on with the :db/add. That's wrong. Also, I don't know if a compound key can work for re-use during a transaction. I need to check on that

🙏 1
Jakub Holý (HolyJak) 2022-04-10T17:37:51.349849Z

You mean what Asami does is wrong or what I do is wrong 😅?

quoll 2022-04-10T17:39:47.766149Z

Hmmm, I thought it was wrong, but maybe not. I think node lookups can only happen when they're in the database to be looked up

quoll 2022-04-10T17:40:18.163639Z

I could create a map during the transaction to try to cache this

quoll 2022-04-10T18:35:15.620299Z

OK... I'm looking at the code, and :db/add does not support node-refs at all. But it won't be hard to add them. I'm working on it now, but I have to leave for the afternoon/evening as I'm taking my daughter somewhere. Hopefully I can get it finished soon

Jakub Holý (HolyJak) 2022-04-10T19:04:49.619619Z

You are wonderful, thank you!