On Mon, Aug 20, 2007 at 08:41:42PM +0200, Markus Gritsch wrote:
> can I use SQLBuilder in some way to perform the query below, so that I
> 1) do not have to write SQL directly and 2) can avoid the manual
> conversion to a date object?

   1 contradicts 2 because SQLBuilder doesn't perform any conversion.
Column objects perform conversions. So, either SQLObject with conversions
or SQLBuilder with raw data,

> for row in connection.queryAll( 'SELECT DISTINCT date(entry.begin)

   SELECT DISTINCT in SQLBuilder is implemented in the trunk by Luke
Opperman. Wait until it will be released as SQLObject 0.10, or use the code
from the trunk, it is stable enough to be useable.

from sqlobject.sqlbuilder import Select, func
for row in conn.queryAll(conn.sqlrepr(
   Select(func.date(Entry.q.begin), distinct=True)
))

Oleg.
-- 
     Oleg Broytmann            http://phd.pp.ru/            [EMAIL PROTECTED]
           Programmers don't die, they just GOSUB without RETURN.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss

Reply via email to