Auto-increment Integer Primary Keys in Ontology

hi!
Checking if there’s updated guidance on having sequential integers as object primary keys/auto-increment?
I’m currently trying to force this behaviour using functions - i.e. find the max existing PK and increment by 1, but wanted to check if there are any GA/w.i.p product features we can leverage here?
E.g. have we considered “Unique Identifier” support for Integer PKs just like string PKs in Ontology Action forms?

2 Likes

Actions allow auto-generating string UUID primary keys but don’t have first-class support for integer primary keys.
You can achieve the desired behavior using a function-backed action by querying the largest current primary key and then generating the next object with an incremented integer but this could lead to your actions failing based on conflicting edits and you may have to retry the actions if the actions are run frequently.

I’m also facing this issue, and it is a definite requirement to have integer PKs. When the Actions submit to the Ontology that are powered by Functions fails because of the ObjectAlreadyExists Error, does the Ontology return this error to the Action that performed it so we can do a retry in the code by add a random number to the PK. We want to know if the Action can pick the error returned by Ontology after the Submission.