Oh my... u r right. I just forgot about JOIN. Or... only to retrive tag name when request, is it good idea to store tag.name with tag.id to reduce JOIN overhead? (I ONLY need tag name) On Jul 27, 2012 7:59 AM, "Michele Comitini" <[email protected]> wrote:
> Why not doing a join on team, auth_user and tags with DAL and then put > the needed field as arg of the .select() method? > The overhead would be minimal. > > mic > > > 2012/7/27 Jaymin Oh <[email protected]>: > > Thanks, Massimo! > > > > On Thu, Jul 26, 2012 at 6:34 PM, Massimo Di Pierro > > <[email protected]> wrote: > >> > >> before you serialize rows in json, you can do: > >> > >> for row in rows: row.tag_names = [db.tag[id].name for is in row.tags] > >> > >> This will be not efficient. depends on how many rows. Perhaps you can > find > >> a faster way to do the conversion. > >> > >> > >> On Wednesday, 25 July 2012 23:32:58 UTC-5, Jaymin Oh wrote: > >>> > >>> Hi, I'm Korean Web2py user. > >>> > >>> > >>> I'm returning output of DB select like 'return dict(teams=teams)'. > >>> > >>> > >>> {"teams": [{"status": "active", "updated_by": 1, "tags": [12], "max": > 4, > >>> "created_by": 1, }]} > >>> > >>> > >>> The above output is my output of 'teams' controller. > >>> > >>> > >>> I have several referencing column, 'tags' and 'created_by'. > >>> > >>> > >>> 'tags' references tag table and created_by references auth table. > >>> > >>> > >>> But I want to add name for 'tags' which exists in 'tag table' and email > >>> for 'created_by' with ID which is already revealed in output. > >>> > >>> > >>> Any help? > >>> > >>> > >>> Thanks for your help in advance. > >>> > >>> > >>> J.Min Oh. > >>> > >>> > >>> > >> -- > >> > >> > >> > > > > > > > > > > -- > > J.Min, Oh, > > M.S Candidate in Department of Knowledge Service Engineering, > > Korea Advanced Institute of Science and Technology > > +82-10-2711-1357 / +82-70-7529-8904 > > > > -- > > > > > > > > -- > > > > --

