Saturday, June 23, 2012

Re: Race and Locking? was Re: Duplicate rows with same key in DB?

On 23-6-2012 0:02, ydjango wrote:
>
> Thank you, I also believe it is Race condition. I do not want to use
> get_or_create as I like to have control over DB writes and updates. I will
> try Unique_together and catch the integrity error exception as Kurtis
> suggested or check again before doing save().
>
> or just thinking aloud, Is there a way to acquire a lock which can
> serialize any other requests which have same "a" and "b" values?

unique_together + transaction middleware.
https://docs.djangoproject.com/en/1.4/topics/db/transactions/
--
Melvyn Sopacua


--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate