I've now tried a make_transient so my code looks like this:

obj = <some object created by adding to a parent's collection>
ses = object_session(obj)
if not ses:
   make_transient(obj)
   ses = Session()
   ses.add(obj)
ses.commit()

I still get the same exception. 

I guess my other option now is to do:

state = attributes.instance_state(obj)
state.detach()

Would that work do you think? BTW would this be considered a bug, should I 
raise a bug report on this?

Cheers,
Ben

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/sqlalchemy/-/vnL1PJednqcJ.
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.

Reply via email to