[Answered ]-How to make this python script memory efficient

2👍

I think andrewski might be right. If you are crashing, try adjusting your Query’s to use the iterator method

Something like.

docs_to_dump = Document.objects.all().order_by('court').iterator()

Should keep from loading your entire Queryset into memory.

Leave a comment