Re: [Django] #29037: Add a bulk_update method to models

2018-02-13 Thread Django
#29037: Add a bulk_update method to models
-+-
 Reporter:  Tom Forbes   |Owner:  nobody
 Type:  New feature  |   Status:  closed
Component:  Database layer   |  Version:  master
  (models, ORM)  |
 Severity:  Normal   |   Resolution:  duplicate
 Keywords:   | Triage Stage:
 |  Unreviewed
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Tim Graham):

 * status:  new => closed
 * resolution:   => duplicate


Comment:

 [https://groups.google.com/d/topic/django-developers/nHH-
 gKPCs6Q/discussion django-developers thread]

 Duplicate of #23646.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/061.f25bdca934f0300b2186f0a69f9dd8f5%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #29037: Add a bulk_update method to models

2018-01-20 Thread Django
#29037: Add a bulk_update method to models
-+-
 Reporter:  Tom Forbes   |Owner:  nobody
 Type:  New feature  |   Status:  new
Component:  Database layer   |  Version:  master
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:
 |  Unreviewed
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Tom Forbes):

 * has_patch:  0 => 1


-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/061.7fe5d827614364f481ec2d31ebaaeaaa%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #29037: Add a bulk_update method to models

2018-01-20 Thread Django
#29037: Add a bulk_update method to models
-+-
 Reporter:  Tom Forbes   |Owner:  nobody
 Type:  New feature  |   Status:  new
Component:  Database layer   |  Version:  master
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:
 |  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Tom Forbes):

 PR: https://github.com/django/django/pull/9606

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/061.81b72431947ec9e406f7c9b7b1f0806d%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #29037: Add a bulk_update method to models

2018-01-18 Thread Django
#29037: Add a bulk_update method to models
-+-
 Reporter:  Tom Forbes   |Owner:  nobody
 Type:  New feature  |   Status:  new
Component:  Database layer   |  Version:  master
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:
 |  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Description changed by Tom Forbes:

Old description:

> Currently it's not easily or neatly possible to update multiple rows with
> differing values using the ORM. Most people who need to update a number
> of models with a value that's distinct to each model need to issue N
> queries. This is akin to the situation that lead to the addition of
> bulk_create.
>
> Updating multiple rows with differing values in a single query is indeed
> possible in SQL, and Postgres has some specific syntax for it[1]. Other
> databases can use a CASE/WHEN:
>
> {{{#!python
> SomeModel.object.filter(id__in=[1,2]).update(
> some_field=Case(
> When(id=1, then=Value('Field value for ID=1')),
> When(id=2, then=Value('Field value for ID=2'))
> )
> )
> }}}
>
> This isn't particularly elegant and cannot take advantage of specific DB
> features (like pg UPDATE FROM), and batching is hard. An API similar to
> bulk_create would be nice:
>
> {{{#!python
> SomeModel.objects.bulk_update(list_of_models, batch_size=100)
> }}}
>
> There is some prior art in the django-bulk-update package[2], which has
> some impressive performance numbers in it's readme.
>
> 1. https://stackoverflow.com/questions/18797608/update-multiple-rows-in-
> same-query-using-postgresql
>
> 2. https://github.com/aykut/django-bulk-update

New description:

 Currently it's not easily or neatly possible to update multiple rows with
 differing values using the ORM. Most people who need to update a number of
 models with a value that's distinct to each model need to issue N queries.
 This is akin to the situation that lead to the addition of bulk_create.

 Updating multiple rows with differing values in a single query is indeed
 possible in SQL, and Postgres has some specific syntax for it[1]. Other
 databases can use a CASE/WHEN:

 {{{#!python
 SomeModel.object.filter(id__in=[1,2]).update(
 some_field=Case(
 When(id=1, then=Value('Field value for ID=1')),
 When(id=2, then=Value('Field value for ID=2'))
 )
 )
 }}}

 This isn't particularly elegant and cannot take advantage of specific DB
 features (like pg UPDATE FROM), and batching is hard. An API similar to
 bulk_create would be nice:

 {{{#!python
 SomeModel.objects.bulk_update(list_of_models, batch_size=100,
 fields=['some_field'])
 }}}

 There is some prior art in the django-bulk-update package[2], which has
 some impressive performance numbers in it's readme.

 1. https://stackoverflow.com/questions/18797608/update-multiple-rows-in-
 same-query-using-postgresql

 2. https://github.com/aykut/django-bulk-update

--

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/061.f9ff88cf2184982cfe09e20c056f5282%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #29037: Add a bulk_update method to models

2018-01-18 Thread Django
#29037: Add a bulk_update method to models
-+-
 Reporter:  Tom Forbes   |Owner:  nobody
 Type:  New feature  |   Status:  new
Component:  Database layer   |  Version:  master
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:
 |  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Description changed by Tom Forbes:

Old description:

> Currently it's not easily or neatly possible to update multiple rows with
> differing values using the ORM. Most people who need to update a number
> of models with a value that's distinct to each model need to issue N
> queries. This is akin to the situation that lead to the addition of
> bulk_create.
>
> Updating multiple rows with differing values in a single query is indeed
> possible in SQL, and Postgres has some specific syntax for it[1]. Other
> databases can use a CASE/WHEN:
>
> {{{#!python
> SomeModel.object.update(
> some_field=Case(
> When(id=1, then=Value('Field value for ID=1')),
> When(id=2, then=Value('Field value for ID=2'))
> )
> )
> }}}
>
> This isn't particularly elegant and cannot take advantage of specific DB
> features (like pg UPDATE FROM), and batching is hard. An API similar to
> bulk_create would be nice:
>
> {{{#!python
> SomeModel.objects.bulk_update(list_of_models, batch_size=100)
> }}}
>
> There is some prior art in the django-bulk-update package[2], which has
> some impressive performance numbers in it's readme.
>
> 1. https://stackoverflow.com/questions/18797608/update-multiple-rows-in-
> same-query-using-postgresql
>
> 2. https://github.com/aykut/django-bulk-update

New description:

 Currently it's not easily or neatly possible to update multiple rows with
 differing values using the ORM. Most people who need to update a number of
 models with a value that's distinct to each model need to issue N queries.
 This is akin to the situation that lead to the addition of bulk_create.

 Updating multiple rows with differing values in a single query is indeed
 possible in SQL, and Postgres has some specific syntax for it[1]. Other
 databases can use a CASE/WHEN:

 {{{#!python
 SomeModel.object.filter(id__in=[1,2]).update(
 some_field=Case(
 When(id=1, then=Value('Field value for ID=1')),
 When(id=2, then=Value('Field value for ID=2'))
 )
 )
 }}}

 This isn't particularly elegant and cannot take advantage of specific DB
 features (like pg UPDATE FROM), and batching is hard. An API similar to
 bulk_create would be nice:

 {{{#!python
 SomeModel.objects.bulk_update(list_of_models, batch_size=100)
 }}}

 There is some prior art in the django-bulk-update package[2], which has
 some impressive performance numbers in it's readme.

 1. https://stackoverflow.com/questions/18797608/update-multiple-rows-in-
 same-query-using-postgresql

 2. https://github.com/aykut/django-bulk-update

--

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/061.dd057df72473fa2b55ccb4d891283e30%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


[Django] #29037: Add a bulk_update method to models

2018-01-18 Thread Django
#29037: Add a bulk_update method to models
-+-
   Reporter:  Tom|  Owner:  nobody
  Forbes |
   Type:  New| Status:  new
  feature|
  Component:  Database   |Version:  master
  layer (models, ORM)|
   Severity:  Normal |   Keywords:
   Triage Stage: |  Has patch:  0
  Unreviewed |
Needs documentation:  0  |Needs tests:  0
Patch needs improvement:  0  |  Easy pickings:  0
  UI/UX:  0  |
-+-
 Currently it's not easily or neatly possible to update multiple rows with
 differing values using the ORM. Most people who need to update a number of
 models with a value that's distinct to each model need to issue N queries.
 This is akin to the situation that lead to the addition of bulk_create.

 Updating multiple rows with differing values in a single query is indeed
 possible in SQL, and Postgres has some specific syntax for it[1]. Other
 databases can use a CASE/WHEN:

 {{{#!python
 SomeModel.object.update(
 some_field=Case(
 When(id=1, then=Value('Field value for ID=1')),
 When(id=2, then=Value('Field value for ID=2'))
 )
 )
 }}}

 This isn't particularly elegant and cannot take advantage of specific DB
 features (like pg UPDATE FROM), and batching is hard. An API similar to
 bulk_create would be nice:

 {{{#!python
 SomeModel.objects.bulk_update(list_of_models, batch_size=100)
 }}}

 There is some prior art in the django-bulk-update package[2], which has
 some impressive performance numbers in it's readme.

 1. https://stackoverflow.com/questions/18797608/update-multiple-rows-in-
 same-query-using-postgresql

 2. https://github.com/aykut/django-bulk-update

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/046.ec1d69311a9707b15e3bca164041b5d4%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.