On Oct 4, 2009, at 7:54 PM, Y3s wrote:

> Session = orm.sessionmaker(autocommit=True, autoflush=False)

you're using non-default session settings, all attributes are expired  
upon transaction commit which in this case due to autocommit makes the  
object unreachable within the flush, so set expire_on_commit=False  
along with your autocommit=True.


> e = create_engine("sqlite:///")
> m.bind = e
> Session.configure(bind=e)
> m.create_all()
>
> # Insert objects...
> s = Session()
> for x in range(1, 6):
>    t = T()
>    t.id = x
>    t.description = "Object %s" % x
>    s.add(t)
> s.flush()
>
> # ...now try to change the ID of one of them...
> o = s.query(T).get(2)
> o.id = 10
> o.description = "Changed"
> s.flush()


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

Reply via email to