Re: Add an defer=True option for model fields

2019-02-20 Thread Adam Johnson
Dan, as to solving your problem with the Django of today: if you don't mention a field in the Django model definition, Django won't select it. So, you can declare the table for two Django models, and use "vertical partitioning" so that when you query one, the other isn't selected, unless it is adde

Re: Add an defer=True option for model fields

2019-02-20 Thread Josh Smeaton
There is a ticket for this one already, filed 4 years ago by me :) https://code.djangoproject.com/ticket/24096 There are a few options described, but I think `defer=True` was winning out. I don't think we considered an `undefer`, but a `defer(None)` would fix that. Once that API is built, then

Re: Add an defer=True option for model fields

2019-02-19 Thread Dan Davis
What I mean by the below: > I was not sure whether to tell him to implement a ModelManager with a get_queryset() method that defers the field, Of course this works, but I'm not going to maintain this code, and that sort of sophistication creates a need for more sophisticated maintenance. On Tue,

Add an defer=True option for model fields

2019-02-19 Thread Dan Davis
I have a developer who stores the binary copy of a file in his table. In ColdFusion, this was acceptable, because he was writing every query by hand, and could simply exclude that field. However, with the Django ORM it is a bit of a problem. The primary table he uses is just for the file, a