Michael,

Thanks for your reply.

On Apr 1, 11:46 am, "Michael Bayer" <[email protected]> wrote:
> there's a nested set demo in the examples/ folder of the distribution,
> which uses MapperExtension as well as a little-used flag on the mapper
> called "batch=False".   are you building off of that ?  

No, I had wrote my own solution b/c I wanted to be able to support
having multiple trees in the same table, but the solution in the
example looked a little cleaner, so I switched to it.

> as far as
> multithread/process, the UPDATE statements which nested sets requires
> would result in a lock of most of the table, thus protecting it from
> concurrent updates.

Yes, but I don't think that solves the problem.  The problem isn't
concurrent updates.  The problem is that the update itself is built on
stale data.  Take code from the example:

http://paste.pocoo.org/show/110684/

Note my comments.  It seems to me that it is possible, although
unlikely, that your entire tree structure will get corrupted unless
you can assure that no other tree update process works between the the
connection.scalar() and connection.execute().  Otherwise, if the tree
is updated between those two calls, in a way that the affects the
value returned from connection.scalar(), then the node structure in
the table gets "corrupt".

> nested sets is extremely inefficient in a
> concurrent write environment.

Agreed.  The environment probably won't be that concurrent that I am
concerned about efficiency.  What I am concerned about is trying to
prevent the node structure from getting corrupted.  If there is even a
remote possibility of the node structure getting corrupt, I would like
to prevent it.

> just that operator alone may render nested sets largely
> obsolete.

I will be happy when there is some kind of backend agnostic way to
accomplish hierarchies.  I can guarantee I won't miss nested sets.

Thank you.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to