[sqlalchemy] Re: One-to-many relation fails with unsaved, pending instance and is an orphan

2009-07-02 Thread Michael Bayer
On May 5, 6:28 pm, Michael Bayer mike...@zzzcomputing.com wrote: the collection is lazy loaded from the database.  autoflush occurs so that any pending values within the collection (items can be present without it being loaded) are persisted, so that you get the right results back. a

[sqlalchemy] Re: One-to-many relation fails with unsaved, pending instance and is an orphan

2009-05-05 Thread Christoph Haas
Michael, thanks a lot for your reply. I haven't yet understood your explanation completely so please allow me to ask further. Am Montag, 4. Mai 2009 23:01:01 schrieb Michael Bayer: the key to the problem is in the traceback: Traceback (most recent call last): File test.py, line 80, in

[sqlalchemy] Re: One-to-many relation fails with unsaved, pending instance and is an orphan

2009-05-05 Thread Michael Bayer
Christoph Haas wrote: So my Session.commit() should do the database action and create one row for the user and one row for the item. So why is there a problem with the autoflushing? SQLAlchemy could save a new logbookentry to the database referring via foreign keys to the user and item rows

[sqlalchemy] Re: One-to-many relation fails with unsaved, pending instance and is an orphan

2009-05-04 Thread Michael Bayer
the key to the problem is in the traceback: Traceback (most recent call last): File test.py, line 80, in module item.logbookentries.append(logbookentry) File /Users/classic/dev/sqlalchemy/lib/sqlalchemy/orm/attributes.py, line 159, in __get__ return