you've got a situation like this:

ft = session.query(FieldType).first()

f = Field()
ft.of_members.append(f)

assert f in session  # normally returns True, assuming normal cascade on 
"of_members"

session.expunge(f)  # remove f from the session

session.flush()   # generates warning, since ft.of_members has changed but the 
contents aren't in the Session

Another cause could be, "of_members" has a cascade that doesn't include 
save-update, like "cascade='delete'" is a common mistake.

On Mar 28, 2012, at 6:45 PM, lars van gemerden wrote:

> Hi all,
> 
> I am getting the error: "SAWarning: Object of type <Field> not in
> session, add operation along 'FieldType.of_members' will not proceed"
> and have no idea where to start looking for the error. Can anyone help
> me with some idea of why this warning occurs or what direction to look
> in order to fix it?
> 
> The warning occurs only during the first call of a specific method,
> while i think i reset everything (e.g. dropping all tables in the
> database) between calls.
> 
> Cheers, Lars
> 
> -- 
> 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.
> 

-- 
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.

Reply via email to