Re: [sqlalchemy] Confusion over session.dirty, query, and flush

2018-09-26 Thread Jonathan Vanasco
On Wednesday, September 26, 2018 at 10:08:43 PM UTC-4, jens.t...@gmail.com wrote: > > > Suppose I get the “new”, “dirty”, and “deleted” sets as per discussion > below, and I’m especially interested in the “dirty” set: is there a way to > find out which properties of an object were modified,

Re: [sqlalchemy] Confusion over session.dirty, query, and flush

2018-09-26 Thread jens . troeger
I’d like to pick up this topic once more briefly. Suppose I get the “new”, “dirty”, and “deleted” sets as per discussion below, and I’m especially interested in the “dirty” set: is there a way to find out which properties of an object were modified, or only that the object was modified?

Re: [sqlalchemy] Confusion over session.dirty, query, and flush

2017-11-21 Thread jens . troeger
Thank you, the event worked like a charm :-) Though I think that I don't need the commit events, because the application terminates anyway. I modified your approach to gather which objects were flushed so that in the end I can give the user more precise information:

Re: [sqlalchemy] Confusion over session.dirty, query, and flush

2017-11-17 Thread jens . troeger
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.

Re: [sqlalchemy] Confusion over session.dirty, query, and flush

2017-11-16 Thread Simon King
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 On Thu, Nov 16, 2017 at 12:55 PM, wrote: > That makes sense, thank you, Simon! > > Regarding the

Re: [sqlalchemy] Confusion over session.dirty, query, and flush

2017-11-16 Thread jens . troeger
That makes sense, thank you, Simon! Regarding the events: you suggest to use a before_flush() to examine session.dirty whenever a session.query() executes? Also, is there a way to get the list of objects that have been flushed, or should I track them myself whenever a before_flush() event

Re: [sqlalchemy] Confusion over session.dirty, query, and flush

2017-11-16 Thread Simon King
On Thu, Nov 16, 2017 at 7:45 AM, wrote: > Hello, > > I've been exploring some of the session functionality that handles object > states, and I'm quite confused. Here is what I see: > engine = engine_from_config({'sqlalchemy.url': 'mysql+pymysql://…'})

[sqlalchemy] Confusion over session.dirty, query, and flush

2017-11-15 Thread jens . troeger
Hello, I've been exploring some of the session functionality that handles object states, and I'm quite confused. Here is what I see: >>> engine = engine_from_config({'sqlalchemy.url': 'mysql+pymysql://…'}) >>> session_factory = sessionmaker(bind=engine) # No autoflush >>> session =