Thanks Mike. It helps and solves the problem. I am still curious why 
process_result_value is called for rows that has null value for same 
objects but not for other rows.

On Thursday, October 5, 2017 at 11:26:47 AM UTC-7, Mike Bayer wrote:
>
> On Thu, Oct 5, 2017 at 1:43 PM, sqlalchemy_mysql <[email protected] 
> <javascript:>> wrote: 
> > Thanks for prompt reply. Narrowed down the issue. 
> > 
> > If the transaction is committed, the query returns fine and processing 
> does 
> > invoke process_result_value with correct/expected value. If the session 
> is 
> > not committed (or just flushed), query doesn't invoke 
> process_result_value 
> > unless if any row has null value for the column. I hope it is expected 
> > functionality, no? If yes, is there other hook that is invoked when 
> > objects/rows are fetched from cache? 
>
> if the session is not committed then you will find that the data that 
> is present in memory on your objects will remain, and is not 
> overwritten by any SQL calls that occur (and thus any 
> process_result_value behaviors) unless you expire the objects in 
> question first: 
>
>
> http://docs.sqlalchemy.org/en/latest/orm/session_state_management.html#refreshing-expiring
>  
>
>
> > 
> > On Wednesday, October 4, 2017 at 9:39:49 PM UTC-7, Mike Bayer wrote: 
> >> 
> >> On Wed, Oct 4, 2017 at 10:47 PM, sqlalchemy_mysql <[email protected]> 
> >> wrote: 
> >> > When query with specific column loads properly and I can see 
> >> > 'result_processor' and/or 'process_result_value' is invoked with 
> correct 
> >> > value but when query directly on Model (no explicit column is 
> specified 
> >> > but 
> >> > all columns are queried in this case by default) invokes those 
> methods 
> >> > with 
> >> > None value. Is this known issue? are there any workaround? I tried 
> both 
> >> > TypeDecorator approach and sub-type approach. 
> >> 
> >> result_processor works in all cases where the type is set up properly, 
> >> in order to see your problem you'd need to provide a complete example 
> >> (see the link for MCVE at the bottom of this email). 
> >> 
> >> 
> >> > 
> >> > -- 
> >> > SQLAlchemy - 
> >> > The Python SQL Toolkit and Object Relational Mapper 
> >> > 
> >> > http://www.sqlalchemy.org/ 
> >> > 
> >> > To post example code, please provide an MCVE: Minimal, Complete, and 
> >> > Verifiable Example. See http://stackoverflow.com/help/mcve for a 
> full 
> >> > description. 
> >> > --- 
> >> > 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 https://groups.google.com/group/sqlalchemy. 
> >> > For more options, visit https://groups.google.com/d/optout. 
> > 
> > -- 
> > SQLAlchemy - 
> > The Python SQL Toolkit and Object Relational Mapper 
> > 
> > http://www.sqlalchemy.org/ 
> > 
> > To post example code, please provide an MCVE: Minimal, Complete, and 
> > Verifiable Example. See http://stackoverflow.com/help/mcve for a full 
> > description. 
> > --- 
> > 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] <javascript:>. 
> > To post to this group, send email to [email protected] 
> <javascript:>. 
> > Visit this group at https://groups.google.com/group/sqlalchemy. 
> > For more options, visit https://groups.google.com/d/optout. 
>

-- 
SQLAlchemy - 
The Python SQL Toolkit and Object Relational Mapper

http://www.sqlalchemy.org/

To post example code, please provide an MCVE: Minimal, Complete, and Verifiable 
Example.  See  http://stackoverflow.com/help/mcve for a full description.
--- 
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 https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to