Re: QuerySet.iterator together with prefetch_related because of chunk_size

2018-10-15 Thread tobias . kroenke
Thank you for your feedback. I would like to answer some statements to 
either convince you or make it more clear, where my idea stems from:

The fundamental reason why iterator() cannot be used with 
> prefetch_related() is that the latter requires a set of model instance to 
> be materialized to work appropriately which chunk_size doesn't control at 
> all.
> In other words chunk_size only controls how many rows should be fetched 
> from the database cursor and kept into memory at a time. Even when this 
> parameter is used, iterator() will only materialize a single model instance 
> per yield.
>
 
It should be easily possible to change the involved code of ModelIterable 
to materialize the retrieved rows in batches. After materializing the batch 
/ chunk, it could do the prefetching.
 

> Given that iterator() always ignored prefetch related lookups instead of 
> erroring out when they were specified make me feel like turning such a 
> feature on by default could be problematic as it could balloon the memory 
> usage which is the main reason why iterator is useful anyway.
>

I would argue, that users who thoughtlessly applied prefetching together 
with iterator now actually get, what they thought of: less DB query round 
trips traded against a little more memory usage.

Best,
Tobi

-- 





Truffls GmbH
Chausseestraße 86, 10115 Berlin 


https://truffls.de 



Vertretungsberechtigte 
Geschäftsführer: Clemens Dittrich, Matthes Dohmeyer Amtsgericht 
Charlottenburg, HRB 160036B


Diese Nachricht ist vertraulich. Sie darf 
ausschließlich durch den vorgesehenen Empfänger und Adressaten gelesen, 
kopiert oder genutzt werden. Sollten Sie diese Nachricht versehentlich 
erhalten haben, bitten wir, den Absender (durch Antwort-E-Mail) hiervon 
unverzüglich zu informieren und die Nachricht zu löschen. Jede Nutzung oder 
Weitergabe des Inhalts dieser Nachricht ist unzulässig.
This message 
(including any attachments) is confidential and may be privileged. It may 
be read, copied and used only by the intended recipient. If you have 
received it in error please contact the sender (by return e-mail) 
immediately and delete this message. Any unauthorized use or dissemination 
of this message in whole or in part is strictly prohibited.


-- 
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/bf7ce18b-db67-4bb9-9be6-2e6946201c58%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Fellow Reports - October 2018

2018-10-15 Thread Tim Graham


Week ending October 13, 2018

Triaged

---

https://code.djangoproject.com/ticket/29790 - Migration that switches a 
model to a UUID primary key fails with "duplicate column name: id" 
(accepted)

https://code.djangoproject.com/ticket/29834 - Union queryset with ordering 
breaks on ordering with derived querysets (accepted)

https://code.djangoproject.com/ticket/29830 - EmailMessage may ignore quote 
printable encoding (accepted)

https://code.djangoproject.com/ticket/29839 - Make leading character in 
quote/unquote in contrib.admin.utils configurable (wontfix)

https://code.djangoproject.com/ticket/29837 - Allow email sending with a 
newline in the subject (wontfix)

https://code.djangoproject.com/ticket/29844 - Cast DecimalField to 
FloatField rounds to integer on MySQL (duplicate)

https://code.djangoproject.com/ticket/29845 - Casting FloatField to 
DecimalField causes MySQL/MariaDB SQL syntax error (accepted)

https://code.djangoproject.com/ticket/29843 - Create permissions using 
migration operations rather than using the post_migrate signal (accepted)

https://code.djangoproject.com/ticket/29833 - Show change form edit links 
on read-only foreign keys (wontfix)

https://code.djangoproject.com/ticket/29826 - urlize does not handle HTML 
angle brackets correctly (wontfix)

Authored

--

https://github.com/django/django/pull/10505 - Refs #29826 -- Removed unused 
characters from urlize configuration.

Reviewed/committed

--

https://github.com/django/django/pull/10487 - Refs #27795 -- Removed 
force_bytes() usage from django/utils/http.py.

https://github.com/django/django/pull/10504 - Fixed #29814 -- Added support 
for NoneType serialization in migrations.

https://github.com/django/django/pull/10499 - Fixed #29832 -- Updated 
Roboto font to v2.137.
https://github.com/django/django/pull/10507 - Simplified 
django.utils.html.urlize().

-- 
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/98a4c2d1-4dca-4624-bb6f-ebe2e65aa817%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: invalid literal for int() with base 10: ''

2018-10-15 Thread Moses Mugisha
  Can you post to stackoverflow instead?. You are probably passing a string
instead of an integer hence the conversion error.

Best
Moses

On Mon, Oct 15, 2018 at 4:47 PM Naamara Hannington 
wrote:

>
> Hey guys. I am developing a django ecommerce site but whenever I click on
> continue to pay button, I get the following error "
>
> invalid literal for int() with base 10: ''
>
> ", what could be the error please.
> Thank you guys
> --
> Naamara Hannington Kangwangye
> Software Developer and CEO Softprog Uganda.
> Web Developer at Crown Integrated Marketing.
> Bsc Comp. Science, KYU
> +256775719034/+256706431210
>
> --
> 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/CAGra9xypcY1YcWJ-hbkH0h8pj1-%3D05Xzss_LH3AqmwSo2irsjA%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CAEF%3D%2BKMuDZoK8OHbzPW30t4jbdbvU3cmQKrJ4tZht-piBXmpFA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: column "" must appear in the GROUP BY clause or be used in an aggregate function

2018-10-15 Thread Kotha bondhu Mithun
sorry friendiam also try it


On Mon, Oct 15, 2018 at 7:37 AM 徐军明  wrote:

> Django 2.1.2, Postgres 10
>
> Model:
> class Product(models.Model):
> product_id = models.AutoField("产品ID", primary_key=True)
> ...
>
> class SpecItem(models.Model):
> spec_id = models.AutoField(primary_key=True)
> product = models.ForeignKey(Product, on_delete=models.CASCADE,
> related_name="product_specs", null=True)
> price = models.FloatField("价格", default=0)
> ...
>
> When exwcute
> qs = Product.objects.filter(valid=1)
> serializer = ProductSerializer(
> qs.annotate(cnt=Count("product_specs"),
> min_price=Min("product_specs__price")).filter(cnt__gt=0)
> .order_by("min_price")[offset:offset + limit],
> context={"request": request},
> many=True)
>
> It says django.db.utils.ProgrammingError: column
> "prome_product.product_name" must appear in the GROUP BY clause or be used
> in an aggregate function
>
>
> Can anyone help me?
>
> --
> 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/d020a431-78db-41b0-809d-a0283a041f7f%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CAJnxJ6uhBG14SkKmpE4O%3DbtChmXheMLiSqF_vhW5hPE4wLdLVg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: invalid literal for int() with base 10: ''

2018-10-15 Thread Adam Johnson
This mailing list is for the development of Django itself, not for support.
Use the django-users mailing list for that, or IRC #django on freenode, or
a site like Stack Overflow.

On Mon, 15 Oct 2018 at 14:57, Moses Mugisha  wrote:

>   Can you post to stackoverflow instead?. You are probably passing a
> string instead of an integer hence the conversion error.
>
> Best
> Moses
>
> On Mon, Oct 15, 2018 at 4:47 PM Naamara Hannington 
> wrote:
>
>>
>> Hey guys. I am developing a django ecommerce site but whenever I click on
>> continue to pay button, I get the following error "
>>
>> invalid literal for int() with base 10: ''
>>
>> ", what could be the error please.
>> Thank you guys
>> --
>> Naamara Hannington Kangwangye
>> Software Developer and CEO Softprog Uganda.
>> Web Developer at Crown Integrated Marketing.
>> Bsc Comp. Science, KYU
>> +256775719034/+256706431210
>>
>> --
>> 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/CAGra9xypcY1YcWJ-hbkH0h8pj1-%3D05Xzss_LH3AqmwSo2irsjA%40mail.gmail.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> 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/CAEF%3D%2BKMuDZoK8OHbzPW30t4jbdbvU3cmQKrJ4tZht-piBXmpFA%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
Adam

-- 
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/CAMyDDM17tXjhBJ-PMrEmqMXm-y9pwdjdf6Mw9JeJLWbv9GNn9w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: column "" must appear in the GROUP BY clause or be used in an aggregate function

2018-10-15 Thread Adam Johnson
This mailing list is for the development of Django itself, not for support.
Use the django-users mailing list for that, or IRC #django on freenode, or
a site like Stack Overflow.

On Mon, 15 Oct 2018 at 02:36, 徐军明  wrote:

> Django 2.1.2, Postgres 10
>
> Model:
> class Product(models.Model):
> product_id = models.AutoField("产品ID", primary_key=True)
> ...
>
> class SpecItem(models.Model):
> spec_id = models.AutoField(primary_key=True)
> product = models.ForeignKey(Product, on_delete=models.CASCADE,
> related_name="product_specs", null=True)
> price = models.FloatField("价格", default=0)
> ...
>
> When exwcute
> qs = Product.objects.filter(valid=1)
> serializer = ProductSerializer(
> qs.annotate(cnt=Count("product_specs"),
> min_price=Min("product_specs__price")).filter(cnt__gt=0)
> .order_by("min_price")[offset:offset + limit],
> context={"request": request},
> many=True)
>
> It says django.db.utils.ProgrammingError: column
> "prome_product.product_name" must appear in the GROUP BY clause or be used
> in an aggregate function
>
>
> Can anyone help me?
>
> --
> 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/d020a431-78db-41b0-809d-a0283a041f7f%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
Adam

-- 
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/CAMyDDM0XWJqYytmOfX7QuE4QTCm7BM%3DpFYJoKCgn0yz5hKP2xw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.