On Thu, Apr 25, 2013 at 2:10 PM, Florian Apolloner <f.apollo...@gmail.com>wrote:
> On Thursday, April 25, 2013 7:06:06 PM UTC+2, Adrian Holovaty wrote: >> >> Also, I should mention that this should be *optional* behavior, as the >> current behavior is reasonable for the common case. The API for specifying >> this "load everything" behavior is a separate discussion. Perhaps a keyword >> argument like: User.objects.only('username', loadall=True). >> > > I could imagine a Meta attribute which introduces so called "deferred > groups" like SA has > http://docs.sqlalchemy.org/en/latest/orm/mapper_config.html#deferred-column-loading, > accessing one column of a group will load all columns of the group. Not > sure if we want that level of control, but I thought it would be worth to > look what SA can do in this regard. > I think groups are a very good abstraction for this problem. The two common cases are probably "Load this column alone, because it's potentially a big honking blob of text or binary" and "Load everything we don't have on this object, because we are actually using it actively". Groups let you solve both problems flexibly. The downside is that they might not be very DRY, having to repeat group="everything" over and over if you just want to load it all on first access. Best, Alex Ogier -- You received this message because you are subscribed to the Google Groups "Django developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-developers+unsubscr...@googlegroups.com. To post to this group, send email to django-developers@googlegroups.com. Visit this group at http://groups.google.com/group/django-developers?hl=en. For more options, visit https://groups.google.com/groups/opt_out.