On May 4, 2008, at 10:59 AM, Paul Johnston wrote:
> Hi, > > I'm writing a ToscaWidget to do a kind of data grid. The way I've > designed it so far, you pass an SA query object to the Widget when > it's created. Then, each time it's displayed, it applies a few extra > filters to the query and fetches the results. I'm using scoped > sessions, and the query ends up being used in several different > threads. > > My initial thoughts are that there could be thread safety problems > with this approach, although in practice it works just fine. How bad > are the threading issues? And is there anything I can do to fix it, > e.g. a step that clones a query and attaches it to the session for > the current thread? > a Query is normally bound to a single Session (and in 0.5, it is always bound as such, the get_session() method is removed) so that approach would present lots of threading issues. A better approach would be to maintain a reference to a callable which produces the Query object you need upon demand. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" 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/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---
