Skip to content

Instantly share code, notes, and snippets.


Artem Ulko ulkoart

  • Russia, Krasnodar
View GitHub Profile
from graphene import relay, String, List
from graphene_django.filter import DjangoFilterConnectionField
from graphene_django.fields import DjangoConnectionField
from app.models import Model
class Object(DjangoObjectType):
class Meta:
model = Model
ulkoart /
Created Oct 31, 2017 — forked from syrusakbary/
Django efficient queryset iterator (by dividing in chunks). Taked from
import gc
def queryset_iterator(queryset, chunksize=1000):
Iterate over a Django Queryset ordered by the primary key
This method loads a maximum of chunksize (default: 1000) rows in it's
memory at the same time while django normally would load all rows in it's
memory. Using the iterator() method only causes it to not preload all the