[web2py] list:reference shouldn't return list of lists in case of aggregates?

48 views
Skip to first unread message

Richard Vézina

unread,
May 17, 2012, 5:13:50 PM5/17/12
to web2py-users
Hello,

I don't know if this has be fixed since 1.99.4, but I can't aggregates a table if a list:reference field is present in the requested fields.

db().select(db.tab1.f2.sum()/db.tab1.f2.count(), db.tab1.f3_list-reference.sum(), groupby=db.tab1.f4) give error... Ok, here I think that ok since the list-reference field maybe should not be consider a normal field and maybe an other set of function should be developped?!

I have 3 records :
list-reference fields : [1,2,3], [4,5,6], [7]

I mean : 
.sum_list_reference() : Should return [[1,2,3], [4,5,6], [7]]
.avg_list_reference() : Should return : [1,2,3,4,5,6,7]
.count_list_reference() : Should count the number of list-reference field in this case 3
etc.

What do you think?

Richard



Massimo Di Pierro

unread,
May 17, 2012, 7:03:17 PM5/17/12
to web...@googlegroups.com
This is not possible because the database does not support it. Lists are not even stored as lists, they are stored as strings.

Richard Vézina

unread,
May 17, 2012, 8:10:20 PM5/17/12
to web...@googlegroups.com
On retrieve only?

Richard 
Reply all
Reply to author
Forward
0 new messages