Hi,

I am trying to do something similar - 
I am using the versioning example from here - 
http://docs.sqlalchemy.org/en/rel_0_7/orm/examples.html?highlight=examples#versioned-objects
But instead of using before_flush I want to use after_bulk_update. This is 
because we use update query in our code and before_flush is not called for 
bulk updates. 

http://stackoverflow.com/questions/14896982/sqlalchemy-versioned-object-not-working
 

I couldn't find a straight fwd way to check if state of the object (is 
dirty?) or check if it is versioned (like in the example above) using the 
session object parameter of after_bulk_insert. I looked at 
"result.context.compiled" I didn't find anything that will give me this 
info.

Has anybody done this? Appreciate any help...

thanks.

On Sunday, July 7, 2013 10:32:44 AM UTC-7, David Szotten wrote:
>
> Awesome, thanks!
>
> (For the record, i was ultimately looking for the field types involved in 
> the update, which i found with your help above as:
>
>     for bind in result.context.compiled.binds.values():
>         field_type = bind.type
>         if isinstance(field_type, MyField):
>             raise NotImplementedError("Bulk updates are not yet supported")
>
>
> Thanks again!
>
>
>
> On 7 July 2013 17:14, Michael Bayer <mik...@zzzcomputing.com <javascript:>
> > wrote:
>
>> this should probably be available as some documented helper function for 
>> now, it's tricky to figure out up front what parameters these events will 
>> need.  Really these "bulk" events should get to know all the arguments that 
>> were passed, including the synchronize_session argument which isn't present 
>> at all right now.
>>
>> that particular info you can get like this:
>>
>> @event.listens_for(Session, "after_bulk_update")
>> def bulk_ud(sess, query, ctx, result):
>>     print result.context.compiled.params
>>
>>
>>
>>
>>
>> On Jul 7, 2013, at 5:51 AM, David Szotten <davids...@gmail.com 
>> <javascript:>> wrote:
>>
>> Hi,
>>
>> Is it possible to find out which class/columns were included in the 
>> update from an `after_bulk_update` event handler?
>>
>> From what i can tell from the source, this information lives on the 
>> `BulkUpdate(Evaluate in my case)` object which isn't passed to the event 
>> handler, and I can't figure out how to access this info from the available 
>> variables (session, query, query_context, result)
>>
>> Thanks
>> -d
>>
>> -- 
>> 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+...@googlegroups.com <javascript:>.
>>
>> To post to this group, send email to sqlal...@googlegroups.com 
>> <javascript:>.
>> 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 a topic in the 
>> Google Groups "sqlalchemy" group.
>> To unsubscribe from this topic, visit 
>> https://groups.google.com/d/topic/sqlalchemy/SwOckp6-Vh8/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to 
>> sqlalchemy+...@googlegroups.com <javascript:>.
>> To post to this group, send email to sqlal...@googlegroups.com 
>> <javascript:>.
>> 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 sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to