[sqlalchemy] DetachedInstanceError after transaction

2012-02-14 Thread Jonathan Vanasco
I seem to get this after I call a transaction.commit

sqlalchemy.orm.exc.DetachedInstanceError
DetachedInstanceError: Instance Useraccount at 0x103f9f610 is
not bound to a Session; attribute refresh operation cannot proceed


In the following code, the first call will print the id [ i called a
flush() previously ], however the second call will generate the error.

print userInstance.id
transaction.commit()
print userInstance.id

anyone have a clue what i can do ?

sqlalchemy is running under pyramid and transaction , and I'm using a
declarative base.

I will admit that i have some janky db sessioning stuff going on
behind the scenes as I get used to pyramid and the new sqlalchemy.
i've cobbled this together from some legacy code and current
https://github.com/jvanasco/pyramid_sqlassist  , and its driving the
app in question.

i can't seem to understand why transaction would clear the session
data out though.

-- 
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To post to this group, send email to sqlalchemy@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.



Re: [sqlalchemy] DetachedInstanceError after transaction

2012-02-14 Thread Claudio Freire
On Tue, Feb 14, 2012 at 6:48 PM, Jonathan Vanasco jonat...@findmeon.com wrote:
 I will admit that i have some janky db sessioning stuff going on
 behind the scenes as I get used to pyramid and the new sqlalchemy.

Then I'd say the janky db sessioning stuff going on behind the
scenes is closing your session after the commit.

-- 
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To post to this group, send email to sqlalchemy@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.