[sqlalchemy] Re: datetime objects unique by date(disregarding time)

2007-09-06 Thread Michael Bayer
you can probably select on DISTINCT trunc(day, somedate) SA would do this like select([distinct(func.trunc(day, mytable.c.datecol))]) On Sep 6, 2007, at 1:37 PM, Pedro Algarvio, aka, s0undt3ch wrote: How could one get only the unique dates from a datetime column, disregarding the

[sqlalchemy] Re: datetime objects unique by date(disregarding time)

2007-09-06 Thread Mike Orr
On 9/6/07, Pedro Algarvio, aka, s0undt3ch [EMAIL PROTECTED] wrote: How could one get only the unique dates from a datetime column, disregarding the time part of the datetime object? MySQL has a DATE() function that chops off the time part. I don't know if Postgres has the same. import

[sqlalchemy] Re: datetime objects unique by date(disregarding time)

2007-09-06 Thread jason kirtland
Some other postgres-friendly options from the IRC channel: select([func.date(model.channel_events.c.stamp)], distinct=True) or select([cast(model.channel_events.c.stamp, Date)], distinct=True) The latter should be portable anywhere, I think. Not sure about the first beyond the 3 usual open