On Sep 23, 4:20 pm, mg <[EMAIL PROTECTED]> wrote: > Hello There, > I am developing an application that uses sqlalchemy and the py > processing packages. My question is this, what is the best practice > for using sessions in this type of app. Each subprocess needs to > access my db to get work, so currently I am starting a scoped session > in the run method of the class and using that session for all db work > within that subprocess. Is that the optimal way, or is there a better > way of working?
Use one scoped session + engine per process. Engines cannot be shared across processes. The scoped session machinery will give you thread local connections. If you are not using threads you do not strictly need scoped sessions, but using them now gives you the flexibility to use them should you choose to at some point in the future. Laurence --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com 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 -~----------~----~----~----~------~----~------~--~---