Yes, I think you can override DAL with your own functions, you could simulate a Expression and BaseAdapter method:
DECRYPT = lambda first: 'decrypt(%s)' % db._adapter..expand(first) decrypt = lambda expr: Expression(expr.db, DECRYPT , expr, None, expr.type) record_list = queryset.select(db.taxpayer.id, db.taxpayer.name, db.taxpayer.tax, db.taxpayer.designation, decrypt(kny_address), decrypt(kny_phone), orderby = myorder) This would generate: select id, name, tax, designation, decrypt(kny_address), decrypt(kny_phone) from ... For more information, you can see gluon/dal.py Best regards, Mariano Reingart http://www.sistemasagiles.com.ar http://reingart.blogspot.com On Fri, Dec 14, 2012 at 3:40 AM, at <matifa...@gmail.com> wrote: > > Hi, > > While fetching records from postgres database using DAL API we need to > decrypt some specific fields. These field names start with some specific > prefix (e.g. kny_). Is there any way that we could override DAL functions to > achieve this requirement? > > Suppose we've following table: > db.define_table('taxpayer', > Field('name'), > Field('tax', 'boolean'), > Field('designation'), > Field('kny_address'), > Field('kny_phone')) > > So my this code: > queryset = db(db.taxpayer) > myorder = db.taxpayer.id > record_list = queryset.select(db.taxpayer.ALL, orderby = myorder) > executes this query, select * from taxpayer order by id > > and I want to change it to: select id, name, tax, designation, > decrypt(kny_address), decrypt(kny_phone). > > > Thanks in advance. > > > > > > > > > > -- > > > --