I've got the following query:
rows = db(query).select(db.ladore_order.total.sum().with_alias('Total'),
db.ladore_order.total.count().with_alias('Transactions'),
db.auth_user.first_name.with_alias('First_name'),
db.auth_user.last_name.with_alias('Last_name'),
groupby=groupy,
orderby=[~db.ladore_order.total.sum()])
Need to modify the Total column before displaying rows (using SQLTABLE for that).
The problem is that something like rows[0].Total=123 doesn't work here, because the rows has the following structure:
<Row {'Total': 123, 'Transactions': 4, 'First_name': 'Vlad', 'Last_name': 'T', '_extra': {'SUM("ladore_order"."total") AS Total': 134878, 'COUNT("ladore_order"."total") AS Transactions': 4, '"auth_user"."first_name" AS First_name': 'Vlad', '"auth_user"."last_name" AS Last_name': 'T'}}>
SQLTable which I use to display rows is not using row.Total , but rather gets info from _extra .
How do I modify the column is rows properly, to be picked up by SQLTable? I don't really understand what this _extra is about and why the data in each rows gets duplicated like that.