[SPAM] Re: sqlobject how to limit return column list

"吕不为" <[email protected]> Tue, 22 Dec 2015 01:06:07 +0800
Newsgroups gmane.comp.python.sqlobject
Message-ID <[email protected]>
i see. thank you Oleg.




------------------ Original ------------------
From: "Oleg Broytman"<[email protected]>; 
Date: 2015年12月20日(星期天) 晚上10:16
To: "sqlobject-discuss"<[email protected]>; 
Subject: Re: [SQLObject] sqlobject how to limit return column list



hi!

On Sun, Dec 20, 2015 at 09:38:56PM +0800, QQ???? <[email protected]> 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/            [email protected]
           Programmers don't die, they just GOSUB without RETURN.

------------------------------------------------------------------------------
_______________________________________________
sqlobject-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss

------------------------------------------------------------------------------

_______________________________________________
sqlobject-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss