On Tue, Mar 23, 2010 at 9:55 PM, jrs <j...@framemedia.com> wrote:
> I have a statement---
>
>    Container.objects.get(
>         pk=container_id
>    ).delete()
>
> This seemingly trivial operation hammers the db with 581 queries!!
> The reason being that the django orm has decided that it will enforce
> referential integrity as a default behavior. As you could imagine,
> this seemingly trivial operation could bring down a site in no time.
> I guess the answer is to override the models delete() method.  If this
> is the case, why is CASCADE not used as an optional attribute by
> django?

This has been proposed.

http://code.djangoproject.com/ticket/7539

We're still looking for a representation of this idea that fits well
with Django's ORM.

> Why is it the default?  Aren't we looking at an obvious way
> for a developer to bring down the house with a seemingly simple 1
> record delete?

Because the alternative is a database without referential integrity.
Django implements a default behavior that ensures the data in your
database is consistent.

Yours,
Russ Magee %-)

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

Reply via email to