Re: [sqlalchemy] Updating a one-to-many relationship

2013-08-12 Thread Tim Van Steenburgh
In `Company.__init__()`, instead of blindly creating a new `Creator` instance, you need to first query for an existing Creator with that name. If it exists, append it, otherwise, create a new one and append that. -- Tim Van Steenburgh On Monday, August 12, 2013 at 9:26 PM, csdr...@gmail.com

Re: [sqlalchemy] Updating a one-to-many relationship

2013-08-12 Thread Tim Van Steenburgh
= relationship(Creator, backref=companies, cascade=all) def __init__(self, company, creator): self.company = company existing_creator = DBSession(Creator).query.filter_by(name=creator).first() self.creator.append(existing_creator or Creator(creator)) -- Tim Van Steenburgh

Re: [sqlalchemy] Updating a one-to-many relationship

2013-08-12 Thread Tim Van Steenburgh
Sorry, that should have been: existing_creator = DBSession(Creator).query.filter_by(creator=creator).first() On Monday, August 12, 2013 at 9:49 PM, Tim Van Steenburgh wrote: It's not the append that's causing the error, it's the fact that you're creating a new Creator() instance, which

Re: [sqlalchemy] Updating a one-to-many relationship

2013-08-12 Thread Tim Van Steenburgh
Ad, one more try: existing_creator = DBSession.query(Creator).filter_by(name=creator).first() -- Tim Van Steenburgh On Monday, August 12, 2013 at 9:50 PM, Tim Van Steenburgh wrote: Sorry, that should have been: existing_creator = DBSession(Creator).query.filter_by(creator

[sqlalchemy] Job Opening

2007-01-25 Thread Tim Van Steenburgh
Tower Hill Insurance Group http://www.thig.com (Gainesville, FL, USA) = JOB DESCRIPTION - We're looking for a talented, enthusiastic programmer to join our web team. You'll be responsible for supporting/enhancing