Awesome. Thanks everyone!

On Friday, September 15, 2017 at 7:01:11 AM UTC-7, Mike Bayer wrote:
>
> On Thu, Sep 14, 2017 at 7:08 PM,  <mi...@benchling.com <javascript:>> 
> wrote: 
> > I'm writing a handler for the "before_commit" event that requires that 
> all 
> > objects have primary key ids, and realizing that "before_commit" runs 
> before 
> > the flush preceding a commit. Is there a way to have the handler run 
> after 
> > the initial flush preceding a commit? Or, alternatively, have an 
> > "after_flush" listener run only on the flush preceding a commit? 
>
> sure, implement before_commit() and put a token inside of session.info 
> - then implement after_flush and look for that token.    you can pop 
> the token out there as well but you'd need to be mindful of error 
> handling, perhaps also pop the token out using after_transaction_end. 
>
> > 
> > -- 
> > 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 sqlalchemy+...@googlegroups.com <javascript:>. 
> > To post to this group, send email to sqlal...@googlegroups.com 
> <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 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.

Reply via email to