Re: [sqlalchemy] Pickle/beaker error with InstrumentedList

2011-12-30 Thread Arturo Sevilla
On Tuesday, December 27, 2011 7:22:03 AM UTC-8, Michael Bayer wrote: On Dec 27, 2011, at 4:54 AM, Arturo Sevilla wrote: Thanks for the code, your example runs without a problem. I've managed to locate the error. In reality it doesn't have to do with InstrumentedList. The problem

Re: [sqlalchemy] Pickle/beaker error with InstrumentedList

2011-12-30 Thread Michael Bayer
On Dec 30, 2011, at 6:34 AM, Arturo Sevilla wrote: import cPickle dumped = cPickle.dumps(user) assert cPickle.loads(dumped).id == 1 # ERROR I get sqlalchemy.orm.exc.DetachedInstanceError: Instance User at 0x1405dd0 is not bound to a Session; attribute refresh operation cannot proceed

Re: [sqlalchemy] Pickle/beaker error with InstrumentedList

2011-12-30 Thread Arturo Sevilla
Ah, OK so what's happening is that _sa_instance_state hasn't yet been assigned to the User object during the unpickle process, then your __eq__() is trying to get at self.id which triggers the attribute system and requires a fully composed User object. Here you'd need to either have a

Re: [sqlalchemy] Pickle/beaker error with InstrumentedList

2011-12-30 Thread Arturo Sevilla
Nope, the problem persists, but not with the unpickle process but after it with composite attributes. For example, I have the first_name attribute on User, but also contact which is a MutableComposite. If I do the following (after the unpickle process): assert user.first_name = 'name' I don't

Re: [sqlalchemy] Pickle/beaker error with InstrumentedList

2011-12-30 Thread Michael Bayer
On Dec 30, 2011, at 7:46 PM, Arturo Sevilla wrote: Nope, the problem persists, but not with the unpickle process but after it with composite attributes. For example, I have the first_name attribute on User, but also contact which is a MutableComposite. If I do the following (after the

Re: [sqlalchemy] Pickle/beaker error with InstrumentedList

2011-12-30 Thread Arturo Sevilla
On Friday, December 30, 2011 8:26:45 PM UTC-8, Michael Bayer wrote: On Dec 30, 2011, at 7:46 PM, Arturo Sevilla wrote: Nope, the problem persists, but not with the unpickle process but after it with composite attributes. For example, I have the first_name attribute on User, but also

Re: [sqlalchemy] Pickle/beaker error with InstrumentedList

2011-12-30 Thread Michael Bayer
On Dec 30, 2011, at 11:35 PM, Arturo Sevilla wrote: On Friday, December 30, 2011 8:26:45 PM UTC-8, Michael Bayer wrote: On Dec 30, 2011, at 7:46 PM, Arturo Sevilla wrote: Nope, the problem persists, but not with the unpickle process but after it with composite attributes. For

Re: [sqlalchemy] Pickle/beaker error with InstrumentedList

2011-12-30 Thread Michael Bayer
On Dec 30, 2011, at 11:47 PM, Michael Bayer wrote: OK so we're down to that same thing, will still see if something can be done. a test case plus a simple patch resolving is at http://www.sqlalchemy.org/trac/ticket/2362 . -- You received this message because you are subscribed to the

Re: [sqlalchemy] Pickle/beaker error with InstrumentedList

2011-12-27 Thread Arturo Sevilla
Thanks for the code, your example runs without a problem. I've managed to locate the error. In reality it doesn't have to do with InstrumentedList. The problem occurs when beaker pickle.load()s from its cache file (a pickled object in a file). I get the following exception (which makes beaker

Re: [sqlalchemy] Pickle/beaker error with InstrumentedList

2011-12-27 Thread Michael Bayer
On Dec 27, 2011, at 4:54 AM, Arturo Sevilla wrote: Thanks for the code, your example runs without a problem. I've managed to locate the error. In reality it doesn't have to do with InstrumentedList. The problem occurs when beaker pickle.load()s from its cache file (a pickled object in a

[sqlalchemy] Pickle/beaker error with InstrumentedList

2011-12-24 Thread Arturo Sevilla
I have an error that occurs after an upgrade to 0.7.4 (from 0.6.8). I use classical mapping but I'm having the following exception when I add it to a session and save() it: TypeError: can't pickle function objects If I directly do pickle.dumps(obj) I get the following exception:

Re: [sqlalchemy] Pickle/beaker error with InstrumentedList

2011-12-24 Thread Michael Bayer
On Dec 24, 2011, at 3:16 PM, Arturo Sevilla wrote: I have an error that occurs after an upgrade to 0.7.4 (from 0.6.8). I use classical mapping but I'm having the following exception when I add it to a session and save() it: TypeError: can't pickle function objects If I directly do