as long as you arent using objectstore.begin(), you should be able to  
just "import sqlalchemy.mods.threadlocal" somewhere in your program,  
search and replace "objectstore.commit()" for "objectstore.flush()",  
change your SQL connect string to an rfc1738, and everything will  
still work.

the only thing that is deprecated in the old pattern is calling the  
query methods directly off the mapper, i.e. mapper.select(), etc.    
but those are still there and will be for awhile.   as long as youre  
using the threadlocal mod, those mapper calls just get replaced with  
Query(MyClass).select() .

so theres no need to have explicit session usage in your program  
beyond the objectstore.flush() youre already doing now.


On Jun 11, 2006, at 2:06 AM, Robert Leftwich wrote:

> I'm just about to embark on the upgrade from 0.1x to 0.2x and given  
> that there
> is a fairly significant amount of work to be done to make it  
> happen, I'm trying
> to work out the best longer term strategy. For me, the most  
> significant change
> is that queries, etc are now on a session not the mapper and I have  
> a lot of
> code that will need to change (as background, no domain objects  
> have SA specific
> knowledge, they call helper functions that are injected at start-up  
> and these
> are SA-specific and know about mappers, tables, etc).
>
> So the first question is what is the long term future of the  
> threadlocal plugin
> - is it safe/prudent to base a major rewrite on this approach?  
> (This looks to
> have the least impact on the existing code, replace any  
> obj.mapper.select() with
> objectstore.get_session().query(Class).select(), etc).
>
> The other option of changing the interfaces to pass around Session  
> instances
> means that all my domain objects have to have knowledge of SA  
> sessions which is
> not good.
>
> It's been a long couple of days (fighting with FreeBSD upgrades),  
> so I'm
> probably not covering all the bases, are there options I'm missing?
>
> Robert
>
>
>
>
> _______________________________________________
> Sqlalchemy-users mailing list
> Sqlalchemy-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users



_______________________________________________
Sqlalchemy-users mailing list
Sqlalchemy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users

Reply via email to