very close to your guess:
def dynamicQuery(table, field, value):
return db(db[table][field] == value).select()
On Friday, 5 July 2013 05:56:16 UTC-5, Remco K wrote:
Hi all,
I have a question:
I want to create queries dynamically:
def dynamicQuery(table, field, value):
return
Very nice! It's working for me like this:
def getValueByID(table, field, id):
return db(db[table].id == id).select().first()[field]
Thanks Massimo!
def dynamicQuery(table, field, value):
return db(db[table][field]id == value).select()
Op vrijdag 5 juli 2013 12:56:16 UTC+2 schreef Remco
Go faster:
def getValueByID(table, field, id):
return db[table][id][field]
which is a shourtcut for :
def getValueByID(table, field, id):
return db(db[table].id == id).select(limitby=(0,1),
orderby_on_limitby=False).first()[field]
2013/7/5 Remco K remc...@gmail.com
Very nice! It's
3 matches
Mail list logo