Re: [sqlalchemy] refresh_flush is not triggered when only the primary key is updated

2016-08-02 Thread Mike Bayer
On 08/02/2016 10:14 AM, Lenar Imamutdinov wrote: The only problem with after_flush() is that it's a session event. Why there is no such event on instance level? because it would involve adding a loop that iterates through all the objects that were flushed and searching each one for event

Re: [sqlalchemy] refresh_flush is not triggered when only the primary key is updated

2016-08-02 Thread Lenar Imamutdinov
The only problem with after_flush() is that it's a session event. Why there is no such event on instance level? On Tuesday, August 2, 2016 at 4:37:19 PM UTC+3, Mike Bayer wrote: > > > > On 08/02/2016 04:24 AM, Lenar Imamutdinov wrote: > > Thank you for the comprehensive answer. Without going

Re: [sqlalchemy] refresh_flush is not triggered when only the primary key is updated

2016-08-02 Thread Mike Bayer
On 08/02/2016 04:24 AM, Lenar Imamutdinov wrote: Thank you for the comprehensive answer. Without going too much into details, I have a table where file associated with each database record, and the name of that file is based on object id. This is what's happening now when I'm doing an INSERT:

Re: [sqlalchemy] refresh_flush is not triggered when only the primary key is updated

2016-08-02 Thread Lenar Imamutdinov
Thank you for the comprehensive answer. Without going too much into details, I have a table where file associated with each database record, and the name of that file is based on object id. This is what's happening now when I'm doing an INSERT: 1. Model instance is created 2. Explicit flush is

Re: [sqlalchemy] refresh_flush is not triggered when only the primary key is updated

2016-07-29 Thread Mike Bayer
Thanks for the great test case and this would be appropriate to be posted as a bug, since it is a complete description. So, the reason the primary key is not included right now is because primary keys are populated in many different ways on the object, meaning if your code relies upon

[sqlalchemy] refresh_flush is not triggered when only the primary key is updated

2016-07-29 Thread Lenar Imamutdinov
Hello! Looks like the refresh_flush event is not triggered when the only field to update after flush is the primary key fed from RETURNING clause. However it should, as far as I understand what is mentioned in the documentation. Environment: SQLAlchemy 1.0.14, PostgreSQL 9.5, Python 3.4 Here