Re: [SQLObject] sqlobject how to limit return column list
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
|
From: Oleg B. <ph...@ph...> - 2015-12-20 14:16:42
|
hi! On Sun, Dec 20, 2015 at 09:38:56PM +0800, QQ???? <171...@qq...> wrote: > Hi. I love sqlojbect very much. > Please forgive my poor English, You're welcome! > Example code: > > class MyUser(SQLObject): > name=StringCol() > mobile=StringCol() > ??. > depart=StringCol() > sex =StringCol() > > i want limit return column, > data=MyUser.selectBy(depart=??xxx??,items=[??name??,??sex']) > > only name and sex column in data. > > Any help would be much appreciated! When you use high-level SQLObject interface (like SQLObject.select, selectBy and such) the result is always a list of SQLObject instances, instances of MyUser in your example, and every instance must have data for all column filled in. If you want to execute less SQLObject-aware queries use Select from SQLBuilder: http://sqlobject.org/SQLBuilder.html#select Oleg. -- Oleg Broytman http://phdru.name/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |