Re: [SQLObject] Selecting only some fields
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: Kevin D. <da...@gm...> - 2005-08-31 02:42:06
|
On 8/30/05, Koen Bok <ko...@ma...> wrote: > Hello. I am writing a server-client application with sqlobject and > pyobjc. To make it as efficient as possible I would like to tell > sqlobject which fields to fetch. I would be surprised if the number of fields being fetched had a significant bearing on the performance of the app. > p =3D Person.selec() always results in 'SELECT * FROM ...' >=20 > I would like it to be: >=20 > 'SELECT name,email,etc FROM...' >=20 > How can I do that? I could not find this in the docs and in the Wiki. SQLObject gives you an object front end for your relational database. To do that, it gives you fully populated objects back, so that you can pass them around and do what you need to do with them. It *could* conceivably allow you to select fewer fields and then generate an error if you try to access one of the fields that wasn't selected. However, I'm not sure if the performance gain is worth the added complication (premature optimization is the root of all evil, after all). Kevin |