Hi All,

I'm working on a variation of this recipe:

http://www.sqlalchemy.org/trac/wiki/UsageRecipes/VersionedRows

...and I've got a couple of questions about changed objects:

- do objects end up in session.dirty as a result of attributes being set or changed?

For example:

class Example(Versioned, Base):
    __tablename__ = 'example'
    id = Column(Integer, primary_key=True)
    data = Column(String)

>>> obj = session.query(Example).get(1)
>>> print obj.data
'something'
>>> obj.data = 'something'

Is obj now considered dirty?
Hopefully not, hopefully it'll only be considered dirty if the following was done:

>>> obj.data = 'something else'

Would both of the above result in obj being dirty or just the latter?
If both, are there any hooks for affecting this behaviour?

- in a SessionExtension's before_flush method, is there any way I can tell which attributes have changed? Or, almost the same, can I check some specific attributes to see if they've changed?

cheers,

Chris

--
Simplistix - Content Management, Batch Processing & Python Consulting
           - http://www.simplistix.co.uk

--
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalch...@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