Recursive 
selects: http://web2py.com/book/default/chapter/06#Recursive-selects. One 
query per record, so a join is more efficient if processing lots of records 
at once.

Anthony

On Saturday, September 24, 2011 1:59:21 AM UTC-4, encompass wrote:
>
> I thought I needed a join to print .name here...
> def create_connections():
>      #get all the user's tags for the about me
>      attribute = db((db.users_tags.event == session.current_event) & 
> (db.users_tags.intent == "attribute"))._select(db.users_tags.tag)
>      #get all the user's tags for the looking for
>      looking_for = db((db.users_tags.event == session.current_event) & 
> (db.users_tags.intent == "looking") & (db.users_tags.user == 
> db.auth_user.id))._select(db.users_tags.tag)
>      interesting_users = db((db.auth_user.id == db.users_tags.user) & 
> (db.users_tags.event == session.current_event) & (db.users_tags.user != 
> auth.user_id) & (db.users_tags.intent == "attribute") & 
> (db.users_tags.tag.belongs(looking_for))).select()
>      print interesting_users
>      for item in interesting_users:
>          print item.auth_user.nickname
>          print item.users_tags.event.name
> Is this some new feature or is it like django where it is lazy and 
> creates another query from that line.
> BR,
> Jason Brower
>
>

Reply via email to