I want to create object with a primary key that will be a forever increasing integer.
Is it possible ?
How can I do this ?
Is this resilient to multiple “create” Actions called in parallel ?
I want to create object with a primary key that will be a forever increasing integer.
Is it possible ?
How can I do this ?
Is this resilient to multiple “create” Actions called in parallel ?
Hi Vincent,
Could you please share your use case? I’m interested to hear it because you’re an advanced user, the docs recommend hashing unique IDs (https://www.palantir.com/docs/foundry/pipeline-builder/unique-id-creation/), and I’m curious if there’s an equivalent primary key for you like a hash of the current user and timestamp.
Joel
One way you could do this is have a separate id object that just keeps track of the latest numerical value and each time you create a new object A, you look at the ID object to get the primary key value (and increment as necessary)
I wouldn’t recommend this over using a hash as Joel mentioned above since it’s harder to maintain
Totally agree. The recommended approach is to use unique UUIDs, or timestamp or a hash of the above.
In some situation, users might really want to have a forever increasing integer. I don’t advise for this nor I believe this is a good solution, but I wanted to check if there are technical solution without weighting the “should it be built”.
The helper object solution is probably the most robust one, but it could increase the number of conflicting actions depending on how frequently they are run.
Relying on the current timestamp could also be an option if you don’t require consecutive integers. Via a function you could convert timestamps to epoch timestamps and write them into the integer property (though that could be vulnerable to clock skew).