[sqlalchemy] Re: Filter by year in datetime column

2008-01-18 Thread King Simon-NFHD78
Would create_date = '2007-01-01' and create_date '2008-01-01' be acceptable? If so, something like this should work from sqlalchemy import and_ from datetime import date data = Table.query().filter(and_([Mikropost.c.create_date = date(2007, 1, 1),

[sqlalchemy] Re: Filter by year in datetime column

2008-01-18 Thread Andreas Jung
--On 18. Januar 2008 12:08:46 -0500 Rick Morrison [EMAIL PROTECTED] wrote: There are no generic date functions in SQLAlchemy (although work has begun on them). So for now, you'll need to use date functions native to your database. For sqlite something like, func.strftime('%Y',

[sqlalchemy] Re: Filter by year in datetime column

2008-01-18 Thread Rick Morrison
There are no generic date functions in SQLAlchemy (although work has begun on them). So for now, you'll need to use date functions native to your database. For sqlite something like, func.strftime('%Y', Mikropost.c.create_date) == '2008' should work -- you may need to add additional percent

[sqlalchemy] Re: Filter by year in datetime column

2008-01-18 Thread Rick Morrison
Such operations will likely trigger a full table scan SQLite dates are stored as strings anyway, AFAIK there is little one can do to avoid table-scans in SQLite based solely on date criteria. I use julian dates stored as integers when working with large datasets in SQLite, and convert as needed.

[sqlalchemy] Re: Filter by year in datetime column

2008-01-18 Thread sdobrev
Rick Morrison wrote: Such operations will likely trigger a full table scan SQLite dates are stored as strings anyway, AFAIK there is little one can do to avoid table-scans in SQLite based solely on date criteria. I use julian dates stored as integers when working with large datasets in