[sqlalchemy] efficiently setting many to many collections when I have a sequence of ids.

2010-10-14 Thread Chris Withers
Hi All, I currently have code that looks like this: recipients = [] if recipient_ids: for id in recipient_ids.split(','): recipients.append( session.query(recipient.Recipient).filter_by(id=id).one() ) else: recipient_ids = () feed.recipients = recipients Where the

Re: [sqlalchemy] efficiently setting many to many collections when I have a sequence of ids.

2010-10-14 Thread Conor
On 10/14/2010 01:30 PM, Chris Withers wrote: Hi All, I currently have code that looks like this: recipients = [] if recipient_ids: for id in recipient_ids.split(','): recipients.append( session.query(recipient.Recipient).filter_by(id=id).one() ) else: