Re: [sqlalchemy] How-to filter by the time part of a datetime field?

2013-08-30 Thread Jonathan Vanasco
In addition to using `func.*` methods, there's also the `extract` method that works (in most databases) specifically on datetime objects. sqlalchemy.sql.expression.extract(*field*, *expr*)

Re: [sqlalchemy] How-to filter by the time part of a datetime field?

2013-08-30 Thread laurent+sqlalchemy
m] On Behalf Of Warwick Prince Sent: Friday, August 30, 2013 8:01 AM To: sqlalchemy@googlegroups.com Subject: Re: [sqlalchemy] How-to filter by the time part of a datetime field? Hi Warwick, On 30/08/2013 14:38, Warwick Prince wrote: I'm sure there is a better way, but you could always filt

RE: [sqlalchemy] How-to filter by the time part of a datetime field?

2013-08-30 Thread Jeff Peck
en(t1, t2)) for row in query.all(): print(row.timestamp) Regards, Jeff Peck -Original Message- From: sqlalchemy@googlegroups.com [mailto:sqlalchemy@googlegroups.com] On Behalf Of Warwick Prince Sent: Friday, August 30, 2013 8:01 AM To: sqlalchemy@googlegroups.com Subject: Re: [sqlalchemy] How-t

Re: [sqlalchemy] How-to filter by the time part of a datetime field?

2013-08-30 Thread Warwick Prince
> Hi Warwick, > > On 30/08/2013 14:38, Warwick Prince wrote: >> I'm sure there is a better way, but you could always filter using a >> date/time and supply the date part as well (i.e. today) so that you are >> comparing datetime to datetime. (Something like: select all rows where the >> dateti

Re: [sqlalchemy] How-to filter by the time part of a datetime field?

2013-08-30 Thread Laurent Meunier
Hi Warwick, On 30/08/2013 14:38, Warwick Prince wrote: I'm sure there is a better way, but you could always filter using a date/time and supply the date part as well (i.e. today) so that you are comparing datetime to datetime. (Something like: select all rows where the datetime is between 20

Re: [sqlalchemy] How-to filter by the time part of a datetime field?

2013-08-30 Thread Warwick Prince
> Hi, > > I've a model with a DateTime column and I need to select rows where the time > part of this column is between two hours (something like: select all rows > where the date is between 6:00 and 11:00). > > I need the date information, rows must be deleted after a couple of days. > > I do