Returing and reusing the identity value
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2024 05:17 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2024 05:35 AM
Hi @dpc ,
What you're trying to achieve does not make sense in the context of identity columns. Look at below entry from documentation. So, the answer is - if you want to have concurrent transaction, don't use identity columns 🙂
Declaring an identity column on a Delta table disables concurrent transactions. Only use identity columns in use cases where concurrent writes to the target table are not required.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2024 07:52 AM
Thanks Slash
In this case though, the batch generation is not concurrent, it's sequential but the full batch running can be concurrent (if that makes sense)
So, I could be running 5 batches in parallel (not necessarily starting at the same time) and all 5 generate a different id.
The batches can differ in terms of what they do but the key here is that, where required, they record the batch id that's relevant to their batch - so the id is recorded consistently (any table writes where needed) throughout
There are some suggestions elsewhere that you can generate one, then just read the last batch id
That wouldn't work here