If you just want to select on a date using datetime, something like the code below ought to work.  Can anyone explain how you could query based on a specific year?  For instance, how would you select all birthdays where year is 1974?

import datetime
from sqlobject import *

sqlhub.processConnection = connectionForURI('sqlite:/:memory:')

class Birthday(SQLObject):
    birthdate = DateTimeCol(notNone = True)

# Create the table, then load in some values.
Birthday(birthdate = datetime.datetime(1974, 4, 12))
Birthday(birthdate = datetime.datetime(1974, 1, 8))
Birthday(birthdate = datetime.datetime(1984, 3, 22))

# Find exact birthdays (day/month/year) combinations.
bday = Birthday.select(Birthday.q.birthdate == datetime.datetime(1974, 04, 12))[0]


On 6/17/07, F.A. Pinkse < f_ap@lycos.nl> wrote:
Hi Oleg,

I found nothing on SQLite to access the subfields of a datetime object.
Only datetime math is supported by SQLite not as a data type in the

I moved back to:

class Birthday(sqlobject.SQLObject):
     day = IntCol()
     month = IntCol()
     year = IntCol()

This gives me back the select on year,month and day.

IF you think the above move is a bad one after all, I would love to hear
your idea's.



This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
sqlobject-discuss mailing list

"Government does not solve problems; it subsidizes them."
Ronald Reagan