Fork me on GitHub
#xtdb
<
2022-08-16
>
roklenarcic14:08:33

Does anyone use anything other than UUIDs for :xt/id? Seems like everything else would require that I manage my own sequence of new IDs when inserting.

phronmophobic15:08:35

I have used maps to enforce unique constraints across multiple properties. I have also used other values when inserting data from another source that already has a primary key. No need to generate an ID since it's intrinsic to the data.

Steven Deobald19:08:46

I use UUIDs everywhere and would generally recommend that unless you have a constraint that pushes you to do something else.

tatut04:08:37

yes, if there is a natural external id that is unique, usually use that

tatut04:08:47

and I wrap the id as a single item map, so instead of {:xt/id #uuid …} it’s something like {:xt/id {:foo/id #uuid …}} where foo is the type of the entity

tatut04:08:24

not that it makes a huge difference, it is just more convenient when seeing the data in repl or inspector that you know the “type” without needing to pull all of it

👍 1