Re: [sqlalchemy] Inject/Extend an attribute onto all objects in a Session?

2016-10-28 Thread Jonathan Vanasco
yeah, `remove` is just a better way to handle scoped sessions. I should really move to regular sessions like you; I keep forgetting that I have these old legacy scoped sessions for no reason. -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://www.sqlalchemy.org/ To

Re: [sqlalchemy] Inject/Extend an attribute onto all objects in a Session?

2016-10-28 Thread Simon King
> On 28 Oct 2016, at 21:47, Jonathan Vanasco wrote: > > oh great! `session.info["request"]` solved all my problems quite nicely. i > integrated that my pipy sessions manager. > > Simon, thanks. Looking at your code, I recall that `dbsession.remove()` may > be better than

Re: [sqlalchemy] Inject/Extend an attribute onto all objects in a Session?

2016-10-28 Thread Jonathan Vanasco
oh great! `session.info["request"]` solved all my problems quite nicely. i integrated that my pipy sessions manager. Simon, thanks. Looking at your code, I recall that `dbsession.remove()` may be better than `dbsession.close()`

Re: [sqlalchemy] Inject/Extend an attribute onto all objects in a Session?

2016-10-28 Thread Simon King
On Fri, Oct 28, 2016 at 3:19 AM, mike bayer wrote: > > > On 10/27/2016 09:41 PM, Jonathan Vanasco wrote: >> >> I have an edge-case in a few situations where, within an @property of a >> SqlAlchemy object, I need to know the current active web-request/context. >> >> I'm

Re: [sqlalchemy] Inject/Extend an attribute onto all objects in a Session?

2016-10-27 Thread mike bayer
On 10/27/2016 09:41 PM, Jonathan Vanasco wrote: I have an edge-case in a few situations where, within an @property of a SqlAlchemy object, I need to know the current active web-request/context. I'm currently using Pyramid's `get_current_request`, but it is no longer recommended -- so I'd like

[sqlalchemy] Inject/Extend an attribute onto all objects in a Session?

2016-10-27 Thread Jonathan Vanasco
I have an edge-case in a few situations where, within an @property of a SqlAlchemy object, I need to know the current active web-request/context. I'm currently using Pyramid's `get_current_request`, but it is no longer recommended -- so I'd like to get a proper solution in place. I have a new