I have a typo for item #7 in my post - this is unexpected. Cases 7 - 10 are the problem. We don't expect there to be changes showing for data that is the same as in the database.
On Thursday, September 15, 2016 at 5:01:40 PM UTC-7, Nicholas A Fries wrote: > > Hi guys, > > The history system in SQLAlchemy seems to think that an object with the > same column values is different than what's in the database. Only it's not. > > Here's a test case I wrote really quick to demonstrate the issue - > https://paste.pound-python.org/show/5FtE85ve08hVoByT6WNj/ > > > 1. Given a single JSON string full of data > 2. Deserialize to a new instance of a model called firstRow (using > marshmallow-sqlalchemy) > 3. Observe that the row shows a change for all columns and child > objects > 4. Add / Commit the row to the database > 5. Deserialize to a new instance of a model called secondRow (again, > using marshmallow-sqlalchemy) > 6. marshmallow-sqlalchemy will return the persistent row from the > database and apply the changes over the top (there are no changes in this > case) > 7. Checking the Session.dirty at this point shows a changed state > (expected - we used the same data) > 8. Checking the hasChanged function I've created shows the websites > column has changed > 9. Checking the contents of websites shows the same data when done for > firstRow (pre-commit) and secondRow > 10. get_history for the websites column shows it was deleted and > re-added > > So, what is strange is that it only happens for the website relationship > (and one other column from the parent table in my actual test environment.) > If it was marshmallow-sqlalchemy, wouldn't it do this for all the > relationships? Also, the values are the same - shouldn't SQLAlchemy check > for this? > > Anyway - does anyone have any thoughts on this? > > > > -- 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 sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at https://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.