Is there an easy way to return a row with a maximum column value in it?  For example:


I have a log records table.  This table logs the status of a bunch of processes that I schedule here.  For a given process, I want to get the latest log record along with the name of the process.


The model looks like this:


class Process(SQLObject):

    class sqlmeta:

        style = Style(longID=True)

        idName = 'processId'


    name = UnicodeCol(length=50)

    processKey = UnicodeCol(length=4)

    description = UnicodeCol()

    startAt = TimeCol()

    intervalMinutes = IntCol()

    gracePeriodMinutes = IntCol()

    createdOn = DateCol(default=datetime.now())


class ProcessLog(SQLObject):

    class sqlmeta:

        style = Style(longID=True)

        idName = 'processLogId'


    process = ForeignKey('Process', dbName='processId')

    started = DateTimeCol()

    completed = DateTimeCol()

    successful = BoolCol()

    executionTime = UnicodeCol(length=50)

    comments = UnicodeCol()


I would like to find the best way to gather this info via SQLObject.  I can’t seem to find any doc that talks about a MAX columnar function.  Is there a good way to do this?




Jim Steil

IT Manager

Quality Liquid Feeds, Inc.


608.341-9896 cell