Hello,
I think I just hit a limitation with web2py dal select query build with conditions...
Here the issue:
if someflag:
columns = [(db[table].date - db.other_table.received_timestamp.date()).avg().with_alias('avg_date')] # This one does work
# Failed on : 'Field' object has no attribute 'date'
columns = [lambda: (db[table].date - db.other_table.received_timestamp.date()).avg().with_alias('avg_date')] # This one does work neither
# Failed on : 'function' object has no attribute 'type'
else:
columns = [(db[table].date - db.other_table.date.date()).avg().with_alias('avg_date')] # This one works
db(...).select(*columns)
Is there a way to make aggregate lazy somehow?
Thanks a lot
Richard