theres two kinds of "change".

one is attribute level, a "state change":

myobject.x = <ANYTHING>

that triggers an event, it places the object in "dirty".  SQLAlchemy doesn't 
waste a lot of time when attributes are being set trying to figure out anything 
about the value, because that is a potentially expensive operation for an 
attribute that might change any number of times more before a flush occurs.   
There are also cases where it doesn't know what the "old" value is anyway, and 
has nothing to compare it to.

the other kind of "change" is history level, an "effective change in value":

from sqlalchemy import inspect

inspect(myobject).attrs.x.history

will actually look at the last <ANYTHING> to be assigned, and perform a 
comparison to what was present in "x" when that object was loaded.   the flush 
always goes forward based on the presence of the first test, but the UPDATE 
statement is always emitted based on the latter test.







On Jul 9, 2013, at 10:53 AM, Сергей Панов <[email protected]> wrote:

> I saw that too when you call setattr alchemy thinks that attr changes. Dont 
> matter if value is the same. I saw it on the third party app.  
> 
> 2013/7/9 Chris Withers <[email protected]>
> What does 'changed' mean?
> 
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "sqlalchemy" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/sqlalchemy.
> For more options, visit https://groups.google.com/groups/opt_out.
>  
>  

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to