On 5/10/07, zopyx01 <[EMAIL PROTECTED]> wrote: > > I integrated Elixir into z3c.sqlalchemy for defining models using > entities. This works fine for now! > z3c.sqlalchemy has an internal registery that maps names to either SA > mappers or Elixir entities. > > Within a Zope thread - each one having its own SA session - > z3c.sqlalchemy need to rebind the > entity to the current session. For this purpose I create a deepcopy() > of the registered entity > and bind the session to the entity copy.
This seem really weird. But let's be clear... When you are talking about entities, are you talking about classes or about instances? I'm assuming you are talking about the classes. Instances are not thread-safe. > Is this safe (I could not find any issues so far) or > is there a better way to reuse an entity within a threaded environment > in concurrent sessions? Well, wouldn't that be a problem if you modify class attributes? Of course in a threaded environment, you'd need proper locking before modifying those, but I prefer to have to lock things than to be unable to modify them at all. Last I checked (a while ago), class attributes didn't work with SQLAlchemy anyway, but I still need to create a test case to confirm that and file a proper bug report about it. In short, can't you just reuse it, and let the developper handle the locking stuff if needed? -- Gaƫtan de Menten http://openhex.org --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "SQLElixir" 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/sqlelixir?hl=en -~----------~----~----~----~------~----~------~--~---
