Re: [Django] #10154: allow the combination of an F expression with a timedelta

2010-10-28 Thread Django
#10154: allow the combination of an F expression with a timedelta
---+
  Reporter:  Koen Biermans   | 
Owner:  nobody 
Status:  new   | 
Milestone: 
 Component:  Database layer (models, ORM)  |   
Version:  SVN
Resolution:|  
Keywords:  expressions
 Stage:  Accepted  | 
Has_patch:  1  
Needs_docs:  0 |   
Needs_tests:  1  
Needs_better_patch:  1 |  
---+
Changes (by coderanger):

 * cc: coderanger (added)

Comment:

 I've been looking in to the problem on SQLite and it looks like it won't
 be easy to fix without fairly invasive changes. With normal values the
 field gets a chance to coerce values into the correct format, but
 SQLEvaluators bail out before this happens. I am going to try hooking up a
 mechanism for the field to be sent to the SQLEvaluator as a type hint.

-- 
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 post to this group, send email to django-upda...@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.



Re: [Django] #10154: allow the combination of an F expression with a timedelta

2010-10-17 Thread Django
#10154: allow the combination of an F expression with a timedelta
---+
  Reporter:  Koen Biermans   | 
Owner:  nobody 
Status:  new   | 
Milestone: 
 Component:  Database layer (models, ORM)  |   
Version:  SVN
Resolution:|  
Keywords:  expressions
 Stage:  Accepted  | 
Has_patch:  1  
Needs_docs:  0 |   
Needs_tests:  1  
Needs_better_patch:  1 |  
---+
Comment (by kmtracey):

 Replying to [comment:15 Alex]:
 > My one note is I'd really like to keep the SQL specific stuff in the SQL
 specific classes (ie sql/expressions.py rather than expressions.py).

 OK...but I'm not really familiar enough with the ORM structure and long-
 term plans for adding non-sql support to understand what exactly to do
 here in response. Are you saying all of !DateModifierNode should be moved
 to sql/expressions.py? Or...?

-- 
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 post to this group, send email to django-upda...@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.



Re: [Django] #10154: allow the combination of an F expression with a timedelta

2010-10-15 Thread Django
#10154: allow the combination of an F expression with a timedelta
---+
  Reporter:  Koen Biermans   | 
Owner:  nobody 
Status:  new   | 
Milestone: 
 Component:  Database layer (models, ORM)  |   
Version:  SVN
Resolution:|  
Keywords:  expressions
 Stage:  Accepted  | 
Has_patch:  1  
Needs_docs:  0 |   
Needs_tests:  1  
Needs_better_patch:  1 |  
---+
Comment (by Alex):

 My one note is I'd really like to keep the SQL specific stuff in the SQL
 specific classes (ie sql/expressions.py rather than expressions.py).

-- 
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 post to this group, send email to django-upda...@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.



Re: [Django] #10154: allow the combination of an F expression with a timedelta

2010-10-15 Thread Django
#10154: allow the combination of an F expression with a timedelta
---+
  Reporter:  Koen Biermans   | 
Owner:  nobody 
Status:  new   | 
Milestone: 
 Component:  Database layer (models, ORM)  |   
Version:  SVN
Resolution:|  
Keywords:  expressions
 Stage:  Accepted  | 
Has_patch:  1  
Needs_docs:  0 |   
Needs_tests:  1  
Needs_better_patch:  1 |  
---+
Comment (by kmtracey):

 I am hoping to get time to work on it this weekend. I have tested on DBs
 including Oracle so I'm pretty comfortable there, mostly I need to check
 again that there is nothing better we can do for some of the DBs for mixed
 date & datetime comparisons and maybe beef up the docs a bit.

-- 
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 post to this group, send email to django-upda...@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.



Re: [Django] #10154: allow the combination of an F expression with a timedelta

2010-10-15 Thread Django
#10154: allow the combination of an F expression with a timedelta
---+
  Reporter:  Koen Biermans   | 
Owner:  nobody 
Status:  new   | 
Milestone: 
 Component:  Database layer (models, ORM)  |   
Version:  SVN
Resolution:|  
Keywords:  expressions
 Stage:  Accepted  | 
Has_patch:  1  
Needs_docs:  0 |   
Needs_tests:  1  
Needs_better_patch:  1 |  
---+
Comment (by glic3rinu):

 kmtracey, Your patch update works good with latest trunk revision (14232)
 and mysql. Would be nice if someone can test it with others databases in
 order to include it in trunk soon :)

-- 
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 post to this group, send email to django-upda...@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.



Re: [Django] #10154: allow the combination of an F expression with a timedelta

2010-06-26 Thread Django
#10154: allow the combination of an F expression with a timedelta
---+
  Reporter:  Koen Biermans   | 
Owner:  nobody 
Status:  new   | 
Milestone: 
 Component:  Database layer (models, ORM)  |   
Version:  SVN
Resolution:|  
Keywords:  expressions
 Stage:  Accepted  | 
Has_patch:  1  
Needs_docs:  0 |   
Needs_tests:  1  
Needs_better_patch:  1 |  
---+
Comment (by kmtracey):

 Updated patch.
  * Reimplemented the sqlite support using a custom function; use of the
 sqlite-provided strftime causes problems because it will only format 3
 digits of fractional second information, plus I do not see how to properly
 format both dates and datetimes in a way that will make them compare
 properly -- including trailing zeros for time information breaks
 comparisons against simple DATE values in sqlite.
  * Disallowed any ops other than addition and subtraction, letting others
 through to be caught by the DB leads to varying and potentially puzzling
 database errors, so it is better to make them fail early.
  * Beefed up the tests and made them unit tests, not doctests.
  * Some of the mixed (date, datetime) comparison tests fail on sqlite.
 That may be unavoidable due to the way it is just (I believe) comparing
 string values. I'm not sure we can code this to know when it is and is not
 right to drop zero-time information, but I have not fully looked into that
 so for now I have not yet coded that test to be skipped on sqlite.

-- 
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 post to this group, send email to django-upda...@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.



Re: [Django] #10154: allow the combination of an F expression with a timedelta

2010-06-21 Thread Django
#10154: allow the combination of an F expression with a timedelta
---+
  Reporter:  Koen Biermans   | 
Owner:  nobody 
Status:  new   | 
Milestone: 
 Component:  Database layer (models, ORM)  |   
Version:  SVN
Resolution:|  
Keywords:  expressions
 Stage:  Accepted  | 
Has_patch:  1  
Needs_docs:  0 |   
Needs_tests:  1  
Needs_better_patch:  1 |  
---+
Changes (by kmtracey):

  * needs_better_patch:  0 => 1
  * needs_tests:  0 => 1

Comment:

 It's clear why [http://dev.mysql.com/doc/refman/5.1/en/datetime.html
 microseconds don't work on MySQL], since the doc states "...microseconds
 cannot be stored into a column of any temporal data type. Any microseconds
 part is discarded." In fact Django
 
[http://code.djangoproject.com/browser/django/tags/releases/1.2.1/django/db/backends/mysql/base.py#L210
 discards them], if they are specified, before they ever reach the DB, in
 order to avoid triggering a warning.

 However, I cannot find anything in the
 [http://www.sqlite.org/lang_datefunc.html SQLite doc] (or tickets) to
 explain why microseconds would not work there. On the other hand I do see
 a couple of possible problems with the code as implemented in the patch
 for SQLite, so at the moment I'm suspicious the reason the tests failed
 for SQLite was that the implementation of the function in the patch for
 SQLite is not quite right.

 First, patch uses the DATETIME() function, but the linked doc shows that
 that function maps to an STRFTIME format string that discards
 microseconds. It may be that we need to use STRFTIME with a format string
 that includes fractional seconds (%f) in order to get this feature to work
 properly. (Which may be a bit of a trick to get the percents in the
 STRFTIME format sting in the generated SQL here to pass through & get
 logged properly when DEBUG is True...or maybe I was just doing something
 wrong in a quick attempt to change the DATETIME to STRFTIME, and I've run
 out of time to look further at this right now.)

 Second, this code (also from the SQLite changes):

 {{{
 #!python
 if timedelta.seconds:
 fs = timedelta.seconds + (timedelta.microseconds / 100.)
 modifiers.append(u'%s seconds' % fs)
 }}}

 isn't going to work properly when the seconds part of the timedelta is 0
 but the microseconds part is non-zero.

 Finally, we should not just fail to test some aspect of a function just
 because one (or even two...but I don't yet see why the SQLite
 implementation of this cannot be made to work) backend does not support
 it. We should have the tests and code them so that they are run on
 backends that support the function and skipped on backends that don't. We
 already do that in other places in the tests and perhaps in the future
 will have a better way of doing it, but completely dropping the fractional
 seconds tests because they don't run properly on all backends is not the
 right answer.

-- 
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 post to this group, send email to django-upda...@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.



Re: [Django] #10154: allow the combination of an F expression with a timedelta

2010-04-29 Thread Django
#10154: allow the combination of an F expression with a timedelta
---+
  Reporter:  Koen Biermans   | 
Owner:  nobody 
Status:  new   | 
Milestone: 
 Component:  Database layer (models, ORM)  |   
Version:  SVN
Resolution:|  
Keywords:  expressions
 Stage:  Accepted  | 
Has_patch:  1  
Needs_docs:  0 |   
Needs_tests:  0  
Needs_better_patch:  0 |  
---+
Comment (by aneil):

 Feature request:  A timedelta database field with support for updates.

 For example:

 {{{
 class Subscribers(Model):
 ...
 next_notification_time = DateTimeField()
 last_notification_time = DateTimeField()
 notification_timedelta = TimeDeltaField()

 
Subscribers.objects.all().update(next_notification_time=F('last_notification_time')+F('notification_timedelta'))
 }}}

 A snippet that implements time delta as an integer field here:
 [http://www.djangosnippets.org/snippets/1060/].

-- 
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 post to this group, send email to django-upda...@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.



Re: [Django] #10154: allow the combination of an F expression with a timedelta

2010-02-03 Thread Django
#10154: allow the combination of an F expression with a timedelta
---+
  Reporter:  Koen Biermans   | 
Owner:  nobody 
Status:  new   | 
Milestone: 
 Component:  Database layer (models, ORM)  |   
Version:  SVN
Resolution:|  
Keywords:  expressions
 Stage:  Accepted  | 
Has_patch:  1  
Needs_docs:  0 |   
Needs_tests:  0  
Needs_better_patch:  0 |  
---+
Changes (by yourcelf):

  * needs_better_patch:  1 => 0
  * needs_docs:  1 => 0

Comment:

 Can someone test oracle with this patch?

 If it passes, I think this ticket is ready for checkin after review from a
 triager/developer.

-- 
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 post to this group, send email to django-upda...@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.



Re: [Django] #10154: allow the combination of an F expression with a timedelta

2010-02-03 Thread Django
#10154: allow the combination of an F expression with a timedelta
---+
  Reporter:  Koen Biermans   | 
Owner:  nobody 
Status:  new   | 
Milestone: 
 Component:  Database layer (models, ORM)  |   
Version:  SVN
Resolution:|  
Keywords:  expressions
 Stage:  Accepted  | 
Has_patch:  1  
Needs_docs:  1 |   
Needs_tests:  0  
Needs_better_patch:  1 |  
---+
Comment (by yourcelf):

 Added a new patch that passes tests against trunk (R12380) for this
 functionality, and implements MySQL.  While microseconds are implemented,
 I removed tests for microseconds, because it seems MySQL and SQLite don't
 fully implement date comparisons involving microseconds.

 Also added full support for MySQL.

 I did not test with Oracle as I don't have an Oracle installation to test
 with (this patch relies on ikelly's patch for the implementation).

-- 
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 post to this group, send email to django-upda...@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.



Re: [Django] #10154: allow the combination of an F expression with a timedelta

2009-04-09 Thread Django
#10154: allow the combination of an F expression with a timedelta
---+
  Reporter:  Koen Biermans   | 
Owner:  nobody 
Status:  new   | 
Milestone: 
 Component:  Database layer (models, ORM)  |   
Version:  SVN
Resolution:|  
Keywords:  expressions
 Stage:  Accepted  | 
Has_patch:  1  
Needs_docs:  1 |   
Needs_tests:  0  
Needs_better_patch:  1 |  
---+
Changes (by gt4329b):

 * cc: gt43...@pobox.com (added)

-- 
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 post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~--~~~~--~~--~--~---



Re: [Django] #10154: allow the combination of an F expression with a timedelta

2009-04-09 Thread Django
#10154: allow the combination of an F expression with a timedelta
---+
  Reporter:  Koen Biermans   | 
Owner:  nobody 
Status:  new   | 
Milestone: 
 Component:  Database layer (models, ORM)  |   
Version:  SVN
Resolution:|  
Keywords:  expressions
 Stage:  Accepted  | 
Has_patch:  1  
Needs_docs:  1 |   
Needs_tests:  0  
Needs_better_patch:  1 |  
---+
Comment (by gt4329b):

 I'm definitely a big juicy +1 on this, as I need it right now for
 [http://www.realmwatcher.com one of my sites]

-- 
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 post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~--~~~~--~~--~--~---



Re: [Django] #10154: allow the combination of an F expression with a timedelta

2009-03-20 Thread Django
#10154: allow the combination of an F expression with a timedelta
---+
  Reporter:  Koen Biermans   | 
Owner:  nobody 
Status:  new   | 
Milestone: 
 Component:  Database layer (models, ORM)  |   
Version:  SVN
Resolution:|  
Keywords:  expressions
 Stage:  Accepted  | 
Has_patch:  1  
Needs_docs:  1 |   
Needs_tests:  0  
Needs_better_patch:  1 |  
---+
Comment (by yourcelf):

 Just added 10154_dateexpressions_4.diff, which implements and has tests
 for fractional seconds in sqlite and postgres, handles the case of a zero
 timedelta, and adds documentation.

-- 
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 post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~--~~~~--~~--~--~---



Re: [Django] #10154: allow the combination of an F expression with a timedelta

2009-02-26 Thread Django
#10154: allow the combination of an F expression with a timedelta
---+
  Reporter:  Koen Biermans   | 
Owner:  nobody 
Status:  new   | 
Milestone: 
 Component:  Database layer (models, ORM)  |   
Version:  SVN
Resolution:|  
Keywords:  expressions
 Stage:  Accepted  | 
Has_patch:  1  
Needs_docs:  1 |   
Needs_tests:  0  
Needs_better_patch:  1 |  
---+
Changes (by Alex):

  * stage:  Unreviewed => Accepted

-- 
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 post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~--~~~~--~~--~--~---



Re: [Django] #10154: allow the combination of an F expression with a timedelta

2009-02-12 Thread Django
#10154: allow the combination of an F expression with a timedelta
---+
  Reporter:  Koen Biermans   | 
Owner:  nobody 
Status:  new   | 
Milestone: 
 Component:  Database layer (models, ORM)  |   
Version:  SVN
Resolution:|  
Keywords:  expressions
 Stage:  Unreviewed| 
Has_patch:  1  
Needs_docs:  1 |   
Needs_tests:  0  
Needs_better_patch:  1 |  
---+
Comment (by ikelly):

 Suggest adding tests for timedeltas with fractional seconds.  The sqlite
 and postgres implementations do not appear to support that at the moment.

-- 
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 post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~--~~~~--~~--~--~---



Re: [Django] #10154: allow the combination of an F expression with a timedelta

2009-01-31 Thread Django
#10154: allow the combination of an F expression with a timedelta
---+
  Reporter:  Koen Biermans   | 
Owner:  nobody 
Status:  new   | 
Milestone: 
 Component:  Database layer (models, ORM)  |   
Version:  SVN
Resolution:|  
Keywords:  expressions
 Stage:  Unreviewed| 
Has_patch:  1  
Needs_docs:  1 |   
Needs_tests:  0  
Needs_better_patch:  1 |  
---+
Changes (by Koen Biermans ):

  * needs_better_patch:  0 => 1
  * needs_docs:  0 => 1

Comment:

 You are right, we can easily do without the leaf. see new patch.

 The dispatching of the nodes should be made more generic though, but I
 don't know which way would be best to go about that.

 I have also added a few more tests.

-- 
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 post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~--~~~~--~~--~--~---



Re: [Django] #10154: allow the combination of an F expression with a timedelta

2009-01-30 Thread Django
#10154: allow the combination of an F expression with a timedelta
---+
  Reporter:  Koen Biermans   | 
Owner:  nobody 
Status:  new   | 
Milestone: 
 Component:  Database layer (models, ORM)  |   
Version:  SVN
Resolution:|  
Keywords:  expressions
 Stage:  Unreviewed| 
Has_patch:  1  
Needs_docs:  0 |   
Needs_tests:  0  
Needs_better_patch:  0 |  
---+
Changes (by Reflejo):

  * needs_better_patch:  => 0
  * needs_tests:  => 0
  * needs_docs:  => 0

Comment:

 I'm mostly -1 regarding how Leaf.evaluate() is implemented. Maybe is more
 simple if timedelta is converted to seconds (delta.seconds + delta.day *
 86400), so you don't need to do that "mods" things :-).

 This way you can move representations to each backend.

-- 
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 post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~--~~~~--~~--~--~---



[Django] #10154: allow the combination of an F expression with a timedelta

2009-01-30 Thread Django
#10154: allow the combination of an F expression with a timedelta
--+-
 Reporter:  Koen Biermans   |   Owner:  
nobody
   Status:  new   |   Milestone:

Component:  Database layer (models, ORM)  | Version:  SVN   

 Keywords:  expressions   |   Stage:  
Unreviewed
Has_patch:  1 |  
--+-
 The proposal is to allow combining a F expression with a timedelta.

 eg:

 {{{
 >>> longevents =
 Event.objects.filter(enddate__gt=F('startdate')+datetime.timedelta(days=5))
 }}}

 would return the events longer than 5 days.

 I am attaching a first patch, which obviously needs refining.

-- 
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 post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~--~~~~--~~--~--~---