Database: PostgreSQL 8.4.4
SQLAlchemy: 0.6
I attempting to query the database for contacts with a recent or
upcoming birthday.
So --
doy = datetime.today().timetuple().tm_yday
floor = doy - 2
if (floor < 1): floor +=365
ceiling = doy + 14
if (ceiling > 365): ceiling -= 365
db.query(Contact).\
filter(func.extract('doy', Contact.birth_date) == doy).all()
-- except this fails with --
sqlalchemy.exc.ProgrammingError: (ProgrammingError) syntax error at or
near ","
LINE 3: WHERE extract(E'doy', person.birthday) = 285 ORDER BY object...
-- the query should be:
SELECT company_id FROM person WHERE extract('doy' from birthday)=285
I assume I'm just missing something.
--
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sqlalchemy?hl=en.