As far as I could understand the SQLAlchemy docs (especially [1], some kind of a centralised session handling is a must have, as the current habit of defining a DBSession = scoped_session actually create separate session factories, and only the session provided by each of these are the same.
That is DBSession = scoped_session(sessionmaker(extension=ZopeTransactionExtension ())) Session1 = DBSession() Session2 = DBSession() Session1 is Session2 -> gives True But DBSession2 = scoped_session(sessionmaker(extension=ZopeTransactionExtension ())) Session3 = DBSession2() Session1 is Session2 -> gives False And the usual habit is the second one, what is quite unfortunate. If I'm correct, than something along the lines of John's session handling or sqlahelper are a must have (aka. "could be part of the framework too"). Do I understand correcly that we would always need a global DBSession? [1]: http://www.sqlalchemy.org/docs/orm/session.html#lifespan-of-a-contextual-session On Sat, Dec 17, 2011 at 10:40 AM, Chris Withers <[email protected]>wrote: > On 16/12/2011 23:48, Michael Bayer wrote: > >> I was just looking to express (and top post, its just easier) that right >> now the "sharing the base" patterns arent' nailed down, but that it can >> be whatever. We can make it work whatever way people think should become >> a best practice. Though usually things go better when I come up with the >> best practice myself after getting a really clear view of the use cases. >> > > More of a SA comment that anything else, but I wish there was one source > of metadata, the MetaData object, rather than having some in the MetaData > object and some in the Base... > > cheers, > > Chris > > > -- > Simplistix - Content Management, Batch Processing & Python Consulting > - http://www.simplistix.co.uk > > -- > You received this message because you are subscribed to the Google Groups > "pylons-discuss" group. > To post to this group, send email to > pylons-discuss@googlegroups.**com<[email protected]> > . > To unsubscribe from this group, send email to pylons-discuss+unsubscribe@* > *googlegroups.com <pylons-discuss%[email protected]>. > For more options, visit this group at http://groups.google.com/** > group/pylons-discuss?hl=en<http://groups.google.com/group/pylons-discuss?hl=en> > . > > -- You received this message because you are subscribed to the Google Groups "pylons-discuss" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
