
Dupicate records created although validate uniqueness is enabled
Hi there,
Weird thing I notice. I process thousands of records of imported data to destination models. I created parallel batch actions to optimise performance by setting a limit and calculating the number of batches and the offset for each batch.
Sometimes I see that records are created multiple times. These records have exactly the same created_at / updated_at values. I already check if I have the record in the model. If so, I update the record. If not, I create a new one.
The problem is, that after this happens, no records can be saved because somewhere in the model the uniqueness constraint is violated.
Only thing to do is find the record from the log (based on Betty ID), then find both records by using the primary key I defined for this record. When I find both records I need to analyse which one can be deleted.
Question: How should I eliminate the creation of duplicate records like this?
Hi there,
Weird thing I notice. I process thousands of records of imported data to destination models. I created parallel batch actions to optimise performance by setting a limit and calculating the number of batches and the offset for each batch.
Sometimes I see that records are created multiple times. These records have exactly the same created_at / updated_at values. I already check if I have the record in the model. If so, I update the record. If not, I create a new one.
The problem is, that after this happens, no records can be saved because somewhere in the model the uniqueness constraint is violated.
Only thing to do is find the record from the log (based on Betty ID), then find both records by using the primary key I defined for this record. When I find both records I need to analyse which one can be deleted.
Question: How should I eliminate the creation of duplicate records like this?
Login to reply