Monday, January 31, 2011

cascading create

Djangoists:

Given a model Tree with many Leaves, I want to write this:

t = Tree(data=42)
t.leaves.add(leafy_data=43)
t.leaves.add(leafy_data=44)
t.save()

I want the save() to create the Tree, then create the leaves. Other
notations would do fine.

Batching like this might permit the ORM to optimize the database
calls. If not, that's okay to.

Google doesn't say Django can do this.

My specific problem is I have a dozen trees with a couple thousand
leaves each, and simply writing them all causes a bottleneck.

--
  Phlip
  http://c2.com/cgi/wiki?ZeekLand

--
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