No that does not work for the reasons discussed above but this does
def getcommentsbydate():
    rows = db(db.test).select(db.test.data.comment, db.test.data)
    for row in rows: row.data = row.data.date()
    return dict(rows=rows)

On Jul 21, 8:06 am, Angelo Compagnucci <angelo.compagnu...@gmail.com>
wrote:
> Sorry for being retarted!
>
> I have this:
>
> db.define_table('test', Field('comment','string'), Field('data','datetime'))
>
> but the function:
>
> def getcommentsbydate():
>    rows = db(db.test).select(db.test.data.comment, db.test.data.date())
>    return dict(rows=rows)
>
> throws an exception complaining that the date() method does not exist.
>
> How can I exctract the date without traverse the rows object? I dont
> want to use a list comprehension or something else because with
> thousands of records is painfull slow (I'm thinking of a radius
> accounting table ...)!
>
> I think there is nothing in the DAL that translates to a "DATE()" sql
> function, am I wrong?
>
> Thank you for your suggestion!

Reply via email to