Sure.

I'm working with two Pyramid/SQLAlchemy web servers, and in order to have a 
more convenient way of looking at the db data I wrote a small tool which 
essentially creates a db session, loads the server orm helper functions and 
sets up an environment much like a view handler functions has. Then the 
tools calls code.interact() 
<https://docs.python.org/3/library/code.html#code.interact> and I have a 
terminal.

>From that terminal I can look at tables, use the server's helper functions 
to read data, but also to write objects.

When I exit interactive mode, I just rolled back the transaction and ended 
the session. However, I'd now like to check: if during that terminal 
session some objects were modified, give the user the choice to either 
commit() or rollback().

To do that, I checked with session.dirty/deleted/new and that's when the 
initial questions arose.

If there are better ways of checking, curious to learn :-)
Thank you!


On Thursday, November 16, 2017 at 11:39:14 PM UTC+10, Simon King wrote:
>
> Can you explain why you actually want to do this? There might be 
> better options than before_flush, but we'd need to know exactly what 
> you're trying to do first. 
>
> Simon 
>

-- 
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