On 7 August 2010 04:57, Dominic LoBue <dominic.lobue@gmail.com> wrote:
Hello,

Is it possible to create a "virtual" column in SQLObject?

To give you an example of what I mean by a virtual column, given a
table named "agtAgent" with a StringCol() named "name", and two
IntCol()'s named "level" and "quality", consider this SQL statement:
select name, level, quality, (((level -1)*2) + (quality/20)) as
reqStanding from agtAgent where reqStanding > %i

Is it possible to do something like this in SQLObject without having
to drop down to writing the sql queries manually?


Hi, check the Using sqlmeta in the main SQLObject documentation

(untested)

class AgtAgent(SQLObject):
    class sqlmeta:
        fromDatabase = True
        columnList = True

    def _get_reqStanding(self):
        return(self.level-1)*2 + (self.quality/20)

HTH

Petr Jakes