Re: Intention behind `adelete` being a queryset method, and not available on a model instance?

2022-10-22 Thread Jason Johns

The explanation makes sense, which is one thing that’s making me feel this 
is something to be called out in the documentation, because it is a 
difference in expectations in the api interface. Since a model has a delete 
method, as does a queryset, the absence of that equivalence for async is 
not what I would expect and it’s not obvious why. 
On Friday, October 21, 2022 at 12:29:31 PM UTC-4 Adam Johnson wrote:

> I opened a ticket to add async methods to Model: 
> https://code.djangoproject.com/ticket/34112
>
> This would be released in Django 4.2, at minimum.
>
> Using async to perform model updates is not likely to be performant, since 
> the queries end up being processed synchronously on a thread anyway. This 
> is because the database libraries Django supports don't have async 
> interfaces.
>
> On Fri, Oct 21, 2022 at 4:49 PM Adam Johnson  wrote:
>
>> If you have a suggestion, sure. But from my perspective the docs are 
>> clear. There's an adelete() method doc'd for QuerySet, and not for Model, 
>> and the release note 
>> 
>>  
>> says “QuerySet now provides an asynchronous interface...”.
>>
>> On Fri, Oct 21, 2022 at 3:51 PM Jason Johns  wrote:
>>
>>> gotcha, then perhaps a documentation tweak would be in order, on both 
>>> queryset and model pages?  because as is, its unclear this is expected.
>>>
>>> On Friday, October 21, 2022 at 9:57:33 AM UTC-4 Adam Johnson wrote:
>>>
 This is intentional, as it stands. Django 4.1 only added async QuerySet 
 methods, not async Model methods. Async model methods like adelete(), and 
 perhaps asave(), would be the next logical step.

 On Fri, Oct 21, 2022 at 1:47 PM Jason Johns  wrote:

> I came across a reddit post yesterday 
> about
>  
> `adelete` raising an attribute error
>
> r = await mymodel.objects.aget(some_name=myname) 
> await r.adelete()
>
> would throw an `AttributeError`,
>
> whereas r = await mymodel.objects.filter(some_name=myname).adelete() 
> works as expected.
>
> I was a little curious about this, and adelete 
> 
>  is 
> explicitly called out in the queryset docs within the `delete` section.  
> but the models doc page  
> only
>  
> contains items about `delete`.  Is this intentional or not, and if it is 
> intentional, perhaps a specific call-out in both queryset and model 
> delete 
> sections would help with clarification.
>
> -- 
> 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-develop...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-developers/82ba40ef-ea73-4492-a2c3-448dbd1b9245n%40googlegroups.com
>  
> 
> .
>
 -- 
>>> 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-develop...@googlegroups.com.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/django-developers/cbb9dbba-be64-4c97-abfe-0b42ed42ddb3n%40googlegroups.com
>>>  
>>> 
>>> .
>>>
>>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/f49f87ed-166e-4da8-baba-218b2da485a2n%40googlegroups.com.


Re: Intention behind `adelete` being a queryset method, and not available on a model instance?

2022-10-21 Thread 'Adam Johnson' via Django developers (Contributions to Django itself)
I opened a ticket to add async methods to Model:
https://code.djangoproject.com/ticket/34112

This would be released in Django 4.2, at minimum.

Using async to perform model updates is not likely to be performant, since
the queries end up being processed synchronously on a thread anyway. This
is because the database libraries Django supports don't have async
interfaces.

On Fri, Oct 21, 2022 at 4:49 PM Adam Johnson  wrote:

> If you have a suggestion, sure. But from my perspective the docs are
> clear. There's an adelete() method doc'd for QuerySet, and not for Model,
> and the release note
> 
> says “QuerySet now provides an asynchronous interface...”.
>
> On Fri, Oct 21, 2022 at 3:51 PM Jason Johns  wrote:
>
>> gotcha, then perhaps a documentation tweak would be in order, on both
>> queryset and model pages?  because as is, its unclear this is expected.
>>
>> On Friday, October 21, 2022 at 9:57:33 AM UTC-4 Adam Johnson wrote:
>>
>>> This is intentional, as it stands. Django 4.1 only added async QuerySet
>>> methods, not async Model methods. Async model methods like adelete(), and
>>> perhaps asave(), would be the next logical step.
>>>
>>> On Fri, Oct 21, 2022 at 1:47 PM Jason Johns  wrote:
>>>
 I came across a reddit post yesterday
 about
 `adelete` raising an attribute error

 r = await mymodel.objects.aget(some_name=myname)
 await r.adelete()

 would throw an `AttributeError`,

 whereas r = await mymodel.objects.filter(some_name=myname).adelete()
 works as expected.

 I was a little curious about this, and adelete
 
  is
 explicitly called out in the queryset docs within the `delete` section.
 but the models doc page
 only
 contains items about `delete`.  Is this intentional or not, and if it is
 intentional, perhaps a specific call-out in both queryset and model delete
 sections would help with clarification.

 --
 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-develop...@googlegroups.com.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/django-developers/82ba40ef-ea73-4492-a2c3-448dbd1b9245n%40googlegroups.com
 
 .

>>> --
>> 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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-developers/cbb9dbba-be64-4c97-abfe-0b42ed42ddb3n%40googlegroups.com
>> 
>> .
>>
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/CAMyDDM3H_JhAYwDhrFs5kpv8C8iq1eGBUbQ1hxOenpZ8rb%2BsqA%40mail.gmail.com.


Re: Intention behind `adelete` being a queryset method, and not available on a model instance?

2022-10-21 Thread 'Adam Johnson' via Django developers (Contributions to Django itself)
If you have a suggestion, sure. But from my perspective the docs are clear.
There's an adelete() method doc'd for QuerySet, and not for Model, and
the release
note

says “QuerySet now provides an asynchronous interface...”.

On Fri, Oct 21, 2022 at 3:51 PM Jason Johns  wrote:

> gotcha, then perhaps a documentation tweak would be in order, on both
> queryset and model pages?  because as is, its unclear this is expected.
>
> On Friday, October 21, 2022 at 9:57:33 AM UTC-4 Adam Johnson wrote:
>
>> This is intentional, as it stands. Django 4.1 only added async QuerySet
>> methods, not async Model methods. Async model methods like adelete(), and
>> perhaps asave(), would be the next logical step.
>>
>> On Fri, Oct 21, 2022 at 1:47 PM Jason Johns  wrote:
>>
>>> I came across a reddit post yesterday
>>> about
>>> `adelete` raising an attribute error
>>>
>>> r = await mymodel.objects.aget(some_name=myname)
>>> await r.adelete()
>>>
>>> would throw an `AttributeError`,
>>>
>>> whereas r = await mymodel.objects.filter(some_name=myname).adelete()
>>> works as expected.
>>>
>>> I was a little curious about this, and adelete
>>> 
>>>  is
>>> explicitly called out in the queryset docs within the `delete` section.
>>> but the models doc page
>>> only
>>> contains items about `delete`.  Is this intentional or not, and if it is
>>> intentional, perhaps a specific call-out in both queryset and model delete
>>> sections would help with clarification.
>>>
>>> --
>>> 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-develop...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-developers/82ba40ef-ea73-4492-a2c3-448dbd1b9245n%40googlegroups.com
>>> 
>>> .
>>>
>> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-developers/cbb9dbba-be64-4c97-abfe-0b42ed42ddb3n%40googlegroups.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/CAMyDDM2VVLGVW01ZcOHPeKk_KafOZ2uEXwjAgqSdjGQb0yBBcg%40mail.gmail.com.


Re: Intention behind `adelete` being a queryset method, and not available on a model instance?

2022-10-21 Thread Jason Johns
gotcha, then perhaps a documentation tweak would be in order, on both 
queryset and model pages?  because as is, its unclear this is expected.

On Friday, October 21, 2022 at 9:57:33 AM UTC-4 Adam Johnson wrote:

> This is intentional, as it stands. Django 4.1 only added async QuerySet 
> methods, not async Model methods. Async model methods like adelete(), and 
> perhaps asave(), would be the next logical step.
>
> On Fri, Oct 21, 2022 at 1:47 PM Jason Johns  wrote:
>
>> I came across a reddit post yesterday 
>> about
>>  
>> `adelete` raising an attribute error
>>
>> r = await mymodel.objects.aget(some_name=myname) 
>> await r.adelete()
>>
>> would throw an `AttributeError`,
>>
>> whereas r = await mymodel.objects.filter(some_name=myname).adelete() 
>> works as expected.
>>
>> I was a little curious about this, and adelete 
>> 
>>  is 
>> explicitly called out in the queryset docs within the `delete` section.  
>> but the models doc page  
>> only
>>  
>> contains items about `delete`.  Is this intentional or not, and if it is 
>> intentional, perhaps a specific call-out in both queryset and model delete 
>> sections would help with clarification.
>>
>> -- 
>> 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-develop...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-developers/82ba40ef-ea73-4492-a2c3-448dbd1b9245n%40googlegroups.com
>>  
>> 
>> .
>>
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/cbb9dbba-be64-4c97-abfe-0b42ed42ddb3n%40googlegroups.com.


Re: Intention behind `adelete` being a queryset method, and not available on a model instance?

2022-10-21 Thread 'Adam Johnson' via Django developers (Contributions to Django itself)
This is intentional, as it stands. Django 4.1 only added async QuerySet
methods, not async Model methods. Async model methods like adelete(), and
perhaps asave(), would be the next logical step.

On Fri, Oct 21, 2022 at 1:47 PM Jason Johns  wrote:

> I came across a reddit post yesterday
> about
> `adelete` raising an attribute error
>
> r = await mymodel.objects.aget(some_name=myname)
> await r.adelete()
>
> would throw an `AttributeError`,
>
> whereas r = await mymodel.objects.filter(some_name=myname).adelete() works
> as expected.
>
> I was a little curious about this, and adelete
> 
>  is
> explicitly called out in the queryset docs within the `delete` section.
> but the models doc page
> only
> contains items about `delete`.  Is this intentional or not, and if it is
> intentional, perhaps a specific call-out in both queryset and model delete
> sections would help with clarification.
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-developers/82ba40ef-ea73-4492-a2c3-448dbd1b9245n%40googlegroups.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/CAMyDDM3L6gz0i9dp7S5xsmE8%2B7GCeY1L5A0h%2BQKxGv7zs6pu9w%40mail.gmail.com.