[sqlalchemy] Best way to find out: outer session

2009-10-15 Thread twiebe
Hello, when building a session extension with after_rollback or (after|before) _commit logic one might want to find out whether the session that triggered the extension by issuing a rollback or commit actually is an outer session resp. actually issues/issued a COMMIT or ROLLBACK to the database,

[sqlalchemy] Re: Session-related best practice advice

2009-04-22 Thread twiebe
Ruben, I did consider and I do use contextual Sessions. However, as all SpoolEntryObjects are fetched and thereby instantiated within the same thread (spooler component), and only afterwards spawn their own individual thread, contextual threads do not help in this regard. I would either need to

[sqlalchemy] Re: Session-related best practice advice

2009-04-22 Thread twiebe
Hello Ruben, hello everyone, I have just found out that there actually is a way to reattach an object to a new session: expunge() it from the old session and add() it to the new session. The new session will recognize that this is not a new object and will work with the existing row accordingly.

[sqlalchemy] Session-related best practice advice

2009-04-21 Thread twiebe
Hello everyone, I have a particular case I first would like to describe to you: I am working on a component to process a spooler that is stored in a table of a MySQL database. This spooler component is running in its own thread. The spooler component is frequently fetching all entries (resp.