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 don't know how-to
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 don't know
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
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
One way to do this is to use a function within your database to convert a
timestamp down to a basic time type, and then do comparison on the converted
value. Here is an example using sqlite as the back end. Sqlite has a time
function that can convert a datetime down to a time for you, so we get at
Wonderfull! Exactly what I was looking for. Thank you Jeff.
I was searching in the sqlalchemy documentation for a time function,
but haven't found one. In fact, you can use any function supported by
the database directly with `func`. So I can use `func.time` and this
will use the TIME
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*,