[SQLObject] Elegant way of running custom queries
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: Simon W. <cs...@ba...> - 2003-09-10 08:54:18
|
Hi all, In an application I'm developing, I need to run a query that I don't think is supported natively by SQLObject. I have a table of Stories, each including the date it was created. I want to find all days within a certain month which contain at least one story. Here's the query I need to run constructed by hand: select distinct dayofmonth(date) from story where date >= '2003-09-01' and date < '2003-10-01' Since this isn't natively supported by SQLObject, what would be the most elegant / "best practise" method for implementing the query? I'd rather not import another Postgres module and use that, so I'm currently swinging towards adding an extra method to the Story class which executes the query using SQLObject's own query mechanism and returns the result. Is there a neater way of doing this? Thanks, Simon |