7 messages in com.googlegroups.sqlalchemy[sqlalchemy] Re: a way to share Sessi...
FromSent OnAttachments
Kumar McMillan24 Jan 2008 12:46 
Kumar McMillan25 Jan 2008 09:15.diff
Michael Bayer25 Jan 2008 09:57 
Kumar McMillan25 Jan 2008 11:02 
Michael Bayer25 Jan 2008 12:18 
Gaetan de Menten30 Jan 2008 05:05 
Jonathan LaCour30 Jan 2008 06:31 
Subject:[sqlalchemy] Re: a way to share Session.mapper(SomeObject) across two scoped sessions?
From:Michael Bayer (mike@zzzcomputing.com)
Date:01/25/2008 12:18:19 PM
List:com.googlegroups.sqlalchemy

On Jan 25, 2008, at 2:02 PM, Kumar McMillan wrote:

On Jan 25, 2008 11:58 AM, Michael Bayer <mike@zzzcomputing.com> wrote:

...so this test will pass if you change setUp to read:

Session.mapper(SomeObject, table, properties={ 'options':relation(SomeOtherObject) }, save_on_init=False) Session.mapper(SomeOtherObject, table2, save_on_init=False)

ah, so it does. I saw that in the code and thought I'd tried it but I guess not. Thanks, this works.

The Session.mapper function is not worth it, in my opinion, it exists due to the sheer popularity of its previous incarnation, "assign_mapper". I much prefer keeping things explicit.

I can understand that. I am trying to get this working for an application that has its entire model declared in Elixir already. I like how easy Elixir is and so I'd rather not abandon that layer. But, there is probably a way to configure Elixir for save_on_init=False, I will give it a go.

elixir shouldn't be dependent on Session.mapper, if it is, I would advise the elixir folks change that requirement ASAP. in my view, at this point elixir should be for mapper configuration only; after that it should hand off to straight SQLAlchemy for normal runtime operation with any kind of Session configuration; else its just getting in the way.