>
> We've always considered that implicit queries on attribute access were an 
> intractable problem. I said it on stage an DjangoCon US 2013. I'm now 
> wondering if I was wrong all along! In an async ORM context, every time we 
> traverse a relation, we could create a Future that would execute the query 
> and resolve to its result. This would require one await per SQL query so 
> we'd still get the benefit of making queries explicit, although to a lesser 
> extent than with an explicit select/prefetch_related.
>

In theory there's nothing stopping you from turning prefetch_related int on 
explicit fetch_related:

queryset = Foo.objects.filter(Foo.publish_date <= datetime.date.today())

queryset = fetch_related(queryset[:10], Foo.author)  # with a future

results = await queryset.all()

fetch_related(results, Foo.category)  # with a result set, returns identity

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/6c2d073d-fa21-43f2-94aa-db12c0f817da%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to