Hi again,

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?

for row in connection.queryAll( 'SELECT DISTINCT date(entry.begin)
FROM %s WHERE %s' % ( ', '.join( query.tablesUsed() ),
connection.sqlrepr( query ) ) ):
    entryDate = row[ 0 ]
    # MySQLdb returns datetime.date objects.
    # pysqlite returns unicode objects of the form u'2007-08-19'.
    if not isinstance( entryDate, datetime.date ):
        entryDate = datetime.datetime.strptime( entryDate, '%Y-%m-%d' ).date()
    # do something with entryDate here

Kind regards,
Markus

-------------------------------------------------------------------------
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