[sqlalchemy] Re: ForeignKey not saved - sqlite3, TG1.1

2009-06-07 Thread Mike Conley
Think of it this way. The original code says set user.blogs to be this list containing exactly one Blog. SQLAlchemy does what you told it to and issues an update removing the foreign key from all blog entries that originally pointed to this user and then inserts a new entry pointing where you

[sqlalchemy] Re: ForeignKey not saved - sqlite3, TG1.1

2009-06-06 Thread Mike Conley
Looks like the culprit is: user.blogs = [Blog(title=input['blog_title'] this replaces your user.blogs relation with a single entry list containing the last Blog try this to add a Blog to the relation list user.blogs.append(Blog(title=input['blog_title')) -- Mike Conley On Fri, Jun 5, 2009

[sqlalchemy] Re: ForeignKey not saved - sqlite3, TG1.1

2009-06-06 Thread Adam Yee
Thanks Mike, it's working now. But I'm curious, how was the foreignkey erased from the previous entry upon each newly added blog? What does .append do that keeps the foreignkeys saved? On Jun 6, 5:24 am, Mike Conley mconl...@gmail.com wrote: Looks like the culprit is: user.blogs =