Skip to content

Instantly share code, notes, and snippets.

Artem Ulko ulkoart

  • Russia, Krasnodar
Block or report user

Report or block ulkoart

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View django_graphene_orderBy.py
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
ulkoart / django_efficient_queryset.py
Created Oct 31, 2017 — forked from syrusakbary/django_efficient_queryset.py
Django efficient queryset iterator (by dividing in chunks). Taked from https://djangosnippets.org/snippets/1949/
View django_efficient_queryset.py
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
classes.
You can’t perform that action at this time.