[sqlalchemy] Re: How do I tell if an object has been INSERTed or UPDATEd?

2007-02-26 Thread Simon Willison
On Feb 26, 3:25 pm, "King Simon-NFHD78" <[EMAIL PROTECTED]> wrote: > If you are wanting to know _after_ the session.flush(), I don't think > session.new/dirty/deleted will help you. Also, your primary key will be > read back from the database immediately after INSERT, so it won't be > None. Betwee

[sqlalchemy] How do I tell if an object has been INSERTed or UPDATEd?

2007-02-26 Thread Simon Willison
Hi all, I've got a bit of code that looks like this: session = get_session() session.save(obj) session.flush() What's the best way of telling if obj has been newly created (INSERT) or merely updated (UPDATE)? I tried just checking for "obj.id is None" but I can't garauntee that my primary key i