I've got some code where I want to assert that the ORM session is perfectly 
clean. ie: I want to know if a flush() will emit SQL.

What is the best way to determine this?

Right now I'm simply checking like this:

if session.new or session.dirty or session.deleted:
    print "flush() actions pending!"

I believe this is a complete way to check this, but I'm wondering if there 
is a more efficient, possibly single point, way to check this.  One reason 
for asking this is that the docs indicate for session.dirty that "this 
collection is now created on the fly each time the property is called"... 
but when all I want to know is "is flush() going to do anything?" it seems 
a waste to generate that collection.

Thanks,
Russ

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