Tuesday, February 26, 2019

Re: My developers have run amok

For the group, the eventual culprit was not complicated.  It is a model with a BinaryField that holds a file's contents. The Django documentation advises against this, but why?   Well, on-premise with big-iron database like Oracle, storing the file in the database is attractive.  So, what's the problem?

      ModelWithFileContents.objects.all()

There you go, even if you are not using the file, its contents will be fetched into memory.
The solution if it must be at the Django level is to use defer() properly, and add it to the ModelManager.

What I did is to make sure the developer *always* used a database view that doesn't have the binary field for most operations.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/28092b88-46a3-4390-8efa-f54072b24768%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment