#28822: Add DBCalculatedField to model to annotate models automatically
-------------------------------------+-------------------------------------
     Reporter:  Ilya                 |                    Owner:  nobody
         Type:  New feature          |                   Status:  new
    Component:  Database layer       |                  Version:  master
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:  Accepted
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by Shai Berger):

 * cc: Shai Berger (added)
 * stage:  Unreviewed => Accepted


Comment:

 I don't really agree with the description's opening statement, that as
 much logic as possible should live within models. But the feature, as
 described above, has gained support and the design as described above is
 mostly in consensus.

 The issue with safety of local calculation is about edge cases. Examples
 include different precisions and rounding rules for numeric calculations;
 different timezones between web-server and database-server for date
 calculations; empty string treated as null on Oracle, while `'' != None`
 in Python; locale (which, on MySql for example, can be defined per column)
 affecting the result of string order comparisons on the database but not
 in Python, and probably more. I believe that it is very easy to be naive
 about this, and this naivety may cause hard-to-debug data corruptions, so
 I'd really like the naming in the API to push this point (e.g. by using a
 name like `estimate` instead of `local` above).

-- 
Ticket URL: <https://code.djangoproject.com/ticket/28822#comment:3>
Django <https://code.djangoproject.com/>
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/071.9f14efcf8266541bbcf7ff37da89725f%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to