We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is there any way to use async with annotate or subquery, count etc.?
filter(query).order_by(order_by).values('pname').annotate(pname=F('pname'), counts=Count( 'plocation'))
The text was updated successfully, but these errors were encountered:
@manoj-punchh It should work just like that, what error do you find using it ?
Sorry, something went wrong.
Error object AsyncQuerySet can't be used in 'await' expression
Here is how I'm making query
data_list = await Policy.aobjects.prefetch_related('plocation_set') .filter(query).order_by(order_by) .values('pname') .annotate(pos_name=F('pname'), applied_locations=Count( 'plocation')) .values('id', 'name', 'status', 'created_at', 'updated_at', 'applied_locations', 'poname').distinct()
Ok thanks , Now I get it working after adding eval at the end of the query.
eval
data_list = await Policy.aobjects.prefetch_related('plocation_set') .filter(query).order_by(order_by) .values('pname') .annotate(pos_name=F('pname'), applied_locations=Count( 'plocation')) .values('id', 'name', 'status', 'created_at', 'updated_at', 'applied_locations', 'poname').distinct().eval()
No branches or pull requests
Is there any way to use async with annotate or subquery, count etc.?
The text was updated successfully, but these errors were encountered: