Fork me on GitHub
#datomic
<
2023-11-09
>
licht1stein13:11:34

I get a strange behavior when trying to upsert using tuple attributes. The schemas is as follows:

{:db/ident :setting.value/setting+target
            :db/doc "Ensure uniqueness for setting values"
            :db/valueType :db.type/tuple
            :db/tupleAttrs [:setting.value/setting :setting.value/target]
            :db/cardinality :db.cardinality/one
            :db/unique :db.unique/identity}
When I insert the first value, it works fine:
{:tx-data [{:setting.value/setting [:setting/id :reports.daily-sales/time]
                                          :setting.value/target [:db/ident :system/system]
                                          :setting.value/value "6"}]}
Then I want to change the value and expect it to be upserted:
{:tx-data [{:setting.value/setting [:setting/id :reports.daily-sales/time]
                                          :setting.value/target [:db/ident :system/system]
                                          :setting.value/value "7"}]}
But instead I get this error:
:db.error/unique-conflict Unique conflict: :setting.value/setting+target, value: [483785117161760 461794884606242] already held by: 488183163672871 asserted for: 470590977628456
So instead of upserting I get an unique conflict, as if I had :db.unique/value What’s especially strange, is this part about asserted for: 470590977628456 , when I try to pull this from the database it shows that the only datom this entity has is :db/id, it’s literally an empty entity. Any ideas what I’m doing wrong?

favila13:11:50

Composite tuple values are computed at the end of tx processing after all entity is resolution is already done, so your second tx is actually making a new entity

favila13:11:40

For composite tuples to work with upsert you need to include the tuple value in the transaction data you submit

licht1stein14:11:36

Yes, this works, thanks!

{:tx-data [{:setting.value/setting+target [483785117161760 461794884606242]
                                         :setting.value/value "0000"}]}

miwal18:11:05

I know this is off topic but anyone else a bit disturbed by OpenAI's keynote yesterday? it's clear this is just another startup to Altman, he's openly full throttle on that playbook - release early and often. We know that all our interactions with GPT are being folded in as extra training data. The last part of the keynote showed a regular webapp where user interaction was replaced with natural language from the user sent to their API, and that same API was provided with hooks it could call to take action on same webapp. It was impressive and I found unsettling. Been trying to identify why I found it unsettling, to reason it out. So I realised: what you're providing the hook to is not just an isolated piece of code in the cloud, it can be thought of as a "single brain" that does the lot. In the same way they fold in our interactions with GPT so far, can be sure any endpoints their AI is able to call could also be thought of as training or within its purview somehow. It will know what they mean and what they do. So can see the creep toward an increasingly powerful, increasingly autonomous, increasingly able-to-take-action-on-the-real-world system. And it's completely centralised. And they're running this as a startup. Which means poker face, fake it till you make it and it's a race against competitors, do anything to get there first.

raspasov21:11:09

Move to #C03RZGPG3 ?