On Friday, October 21, 2011 6:03:53 AM UTC-4, Martin.Mulone wrote:
>
> I think is row['sum']


The actual dict key is 'SUM(t_payement.f_value)', so 'sum' (in quotes) won't 
work in this case. It turns out that str(sum) equals 
'SUM(t_payement.f_value)', though, so you can do row[str(sum)]. However, the 
row object automatically applies str() to any keys, so row[sum] is 
equivalent to row[str(sum)]. row is also a callable object, so you can do 
row(sum).

Note, 'SUM(t_payement.f_value)' is the actual SQL expression generated by 
the DAL Expression (i.e., db.t_payement.f_value.sum() generates the SQL
 'SUM(t_payement.f_value)', at least in the particular DB adapter being 
used). str(expression) returns this SQL, and it is also used as the key to 
access the result in the Row object.

Anthony

Reply via email to