Re: [sqlalchemy] Versioned object example

2014-01-25 Thread Simon King
Oh, yes, of course, I forgot that foreign keys aren’t immediately updated when you manipulate a relationship. Your suggested change sounds exactly right. Thanks again, Simon On 25 Jan 2014, at 02:30, Michael Bayer mike...@zzzcomputing.com wrote: well since create_version() is called

[sqlalchemy] Versioned object example

2014-01-24 Thread Simon King
Hi again, While testing the complicated relationship from the other thread, I noticed that I was generating a lot of queries that I couldn't immediately explain. After a bit of digging, it turned out that it was due to my use of code based on the versioned objects example at

Re: [sqlalchemy] Versioned object example

2014-01-24 Thread Michael Bayer
without looking too deeply, you can modify that get_history() call to not emit any SQL, assuming you’re on 0.9 (maybe on 0.8 also but the API has been fixed up). Take a look at passing the “passive” flag to get_history(), or alternatively using inspect().attrs.data.history:

Re: [sqlalchemy] Versioned object example

2014-01-24 Thread Michael Bayer
well since create_version() is called within before_flush(), the net effect of any changes on local many-to-one relationships can only be taken into account by looking at these attributes. The test in test_versioning called test_relationship illustrates this. so the diff is like this, the