[sqlalchemy] Re: session.merge(obj, load=False) yields Parent instance is not bound to a Session; lazy load operation of attribute 'predecessor' cannot proceed

2010-04-16 Thread Paul Balomiri
My Fault, session.merge(obj, load=False) should be obj=session.merge(obj, load=False) 2010/4/17 Paul Balomiri : > Hi, > > I was just trying to load a relation ( obj.predecessor) for obj. > obj was created in a session, which has been committed, and closed afterwards. > I merged obj to the ses

[sqlalchemy] Re: session.merge()

2009-01-17 Thread n00b
actually, this is exactly what i didn't want to do .. at least not explicitly. thx. On Jan 17, 3:24 am, Laurent Rahuel wrote: > Hi, > > Did you first load the entry to update into the session or do you   > always create new objects to be saved ? > I guess you need to: > > 1 - try to get the reco

[sqlalchemy] Re: session.merge()

2009-01-17 Thread n00b
thanks. i'll give it a shot. On Jan 17, 10:43 am, Michael Bayer wrote: > On Jan 17, 2009, at 4:07 AM, n00b wrote: > > > > > > > greetings, > > > i'm batch processing xml documents to mysql using SA 0.5, ORM. > > > data extracted from xml docs may be new or an update in form of a > > replacement

[sqlalchemy] Re: session.merge()

2009-01-17 Thread Michael Bayer
On Jan 17, 2009, at 4:07 AM, n00b wrote: > > greetings, > > i'm batch processing xml documents to mysql using SA 0.5, ORM. > > data extracted from xml docs may be new or an update in form of a > replacement of > the existing object (record). (one of the columns, product_id, is > unique=True). He

[sqlalchemy] Re: session.merge()

2009-01-17 Thread Laurent Rahuel
Hi, Did you first load the entry to update into the session or do you always create new objects to be saved ? I guess you need to: 1 - try to get the record from the database using the product_id or another unique field 2 - if the result set is not empty, update the record using value

[sqlalchemy] Re: Session.merge changing related objects?

2008-12-12 Thread Michael Bayer
I modified the test to run against UnitTest since I dont have nose installed, and all tests pass for me. My version is attached. Make sure you're actually running 0.5 since the test seems to be testing behavior that didn't work in older 0.4 versions of SQLA (although the other tests seem

[sqlalchemy] Re: Session.merge vs. mapper extensions

2008-05-01 Thread Michael Bayer
On Apr 30, 2008, at 11:24 PM, Rick Morrison wrote: > right, sorry, before_insert yeah if the INSERT is happening, and its in _save_obj(), the before_insert is there. theres no "insert the row but dont call before_insert" going on. Can you dig into it some more ? --~--~-~--~

[sqlalchemy] Re: Session.merge vs. mapper extensions

2008-04-30 Thread Rick Morrison
is not being called. as you call tell, I'm having trouble with the keyboard tonight. first message was a typo, --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email

[sqlalchemy] Re: Session.merge vs. mapper extensions

2008-04-30 Thread Rick Morrison
right, sorry, before_insert On Wed, Apr 30, 2008 at 11:18 PM, Michael Bayer <[EMAIL PROTECTED]> wrote: > > > On Apr 30, 2008, at 10:47 PM, Rick Morrison wrote: > > > I just started using session.merge, and I noticed that on > > session.flush(), the before_update mapper extension for the objects

[sqlalchemy] Re: Session.merge vs. mapper extensions

2008-04-30 Thread Michael Bayer
On Apr 30, 2008, at 10:47 PM, Rick Morrison wrote: > I just started using session.merge, and I noticed that on > session.flush(), the before_update mapper extension for the objects > that have been merged into the session are not called. > > These are new instances, not previously persisted.