- changed component to sql
- changed title to build generic functions for max, min
- marked as major
- changed milestone to 0.5.xx
- marked as enhancement
build generic functions for max, min
result of a ''select ... max(col)'' where col is a DateTime or Numeric (or may be others) does not return this type but a "simple" scalar type like unicode, int, float...
It may be specific to SQLite.
Comments (6)
-
repo owner -
Account Deleted I've just attached a patch and test. I hope it will be ok (my first patch for SA...)
Remi.
-
repo owner - changed milestone to 0.5.0
It looks pretty good. there's a lot of other functions that fall under this category, like "avg()", etc. but we can start with that one. will try to get it for 0.5.0.
-
Account Deleted Before sending the patch, I had tried to add avg also but when I tested it against a sqlite db, it raised an error (AttributeError) when trying to do A.query.avg(DateTimeColumn)...
I think that all functions that return a scalar value should fall under the same category. I've just tested sum(). Of course sum(Date) is nonsense but sum(Decimal) should return a Decimal...
-
repo owner - changed status to resolved
added min, max, sum in 58c5bb7fc104da26cd1797d9680a810a3b79ab0a.
-
repo owner - removed milestone
Removing milestone: 0.5.0 (automated comment)
- Log in to comment
if anyone is interested in volunteering for this, the functions would be added to lib/sqlalchemy/sql/functions.py, unit tests in test/sql/functions.py .
FYI the current non-generic methodology is:
hence not a bug.