[sqlalchemy] Re: Matching a DateTime-field

2007-12-15 Thread Mike Orr
Can't you use a BETWEEN or >= and < with two dates? If your date column is indexed, as it should be if you're using it frequently in where clauses, the overhead of DATE_FORMAT decreases substantially. On Dec 12, 2007 3:43 PM, Adam B <[EMAIL PROTECTED]> wrote: > > > > On Dec 11, 10:55 am, "King S

[sqlalchemy] Re: Matching a DateTime-field

2007-12-12 Thread Adam B
On Dec 11, 10:55 am, "King Simon-NFHD78" <[EMAIL PROTECTED]> wrote: > It may not matter to you, but I wouldn't have thought this would be a > very efficient query, because the database is going to have to call the > DATE_FORMAT function twice for every row in your table. I would have > thought a

[sqlalchemy] Re: Matching a DateTime-field

2007-12-11 Thread King Simon-NFHD78
Sent: 10 December 2007 19:15 > To: sqlalchemy > Subject: [sqlalchemy] Re: Matching a DateTime-field > > > Hello! > > Thanks for the pointers. > > Here is the solution for MySQL : > session.query(List).filter(and_(func.DATE_FORMAT(List.expire,'%Y&

[sqlalchemy] Re: Matching a DateTime-field

2007-12-10 Thread Adam B
Hello! Thanks for the pointers. Here is the solution for MySQL : session.query(List).filter(and_(func.DATE_FORMAT(List.expire,'%Y') ==2007 ,func.DATE_FORMAT(List.expire,"%m") == 12)).all() On Dec 10, 6:08 pm, "Rick Morrison" <[EMAIL PROTECTED]> wrote: > Yeah, it was a "for instance" answer,

[sqlalchemy] Re: Matching a DateTime-field

2007-12-10 Thread Rick Morrison
Yeah, it was a "for instance" answer, you'll need to use the correct MySql syntax of course. On 12/10/07, Adam B <[EMAIL PROTECTED]> wrote: > > > On Dec 10, 1:16 am, "Rick Morrison" <[EMAIL PROTECTED]> wrote: > > Any query using sql expressions is going to want to use correctly typed > data > > --

[sqlalchemy] Re: Matching a DateTime-field

2007-12-10 Thread Adam B
On Dec 10, 1:16 am, "Rick Morrison" <[EMAIL PROTECTED]> wrote: > Any query using sql expressions is going to want to use correctly typed data > -- you're trying to query a date column with a string value. The LIKE > operator is for string data. > > I'm not up on my mssql date expressions, but the

[sqlalchemy] Re: Matching a DateTime-field

2007-12-10 Thread Adam B
On Dec 10, 1:16 am, "Rick Morrison" <[EMAIL PROTECTED]> wrote: > Any query using sql expressions is going to want to use correctly typed data > -- you're trying to query a date column with a string value. The LIKE > operator is for string data. > > I'm not up on my mssql date expressions, but the

[sqlalchemy] Re: Matching a DateTime-field

2007-12-09 Thread Rick Morrison
Any query using sql expressions is going to want to use correctly typed data -- you're trying to query a date column with a string value. The LIKE operator is for string data. I'm not up on my mssql date expressions, but the answer is going to resemble something like this: .filter(and_(fu