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.createTable()
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]
hth,
jw
On 6/17/07, F.A. Pinkse <[EMAIL PROTECTED]> 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
database.
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.
Thanks,
Frans.
-------------------------------------------------------------------------
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.
http://sourceforge.net/powerbar/db2/
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss
--
"Government does not solve problems; it subsidizes them."
Ronald Reagan
-------------------------------------------------------------------------
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.
http://sourceforge.net/powerbar/db2/
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss