On Jan 20, 2006, at 4:17 PM, [EMAIL PROTECTED] wrote:
nevertheless, i also wonder if this is something
that you expect to support in the future?
sorry to be bringing up less common use-cases,
but sqlalchemy gives me the hope of leveraging
these features through python.
I would love to add that feature, however I have no idea how to
implement it.
Well, im exaggerating, I have some semblence of a clue, but it would
take some major brain power to work it out, as the existing "self-
referential" dependency code has completely blown a gasket in my
brain to produce. I have been working on its logging output in order
to have greater mastery over it so that I can see how to generalize
it across multiple mappers.
The "circular" dependency code, when detecting a mapper that
references itself, goes through an extra step when sorting
dependencies to sort the individual object instances into their own
dependency graph. usually, dependencies are only sorted at the
mapper level, i.e. mapper A is dependent on mapper B. this detection
is the (x==y)-> x.circular=True code.
The basic idea would be, instead of detecting (x==y) ->
x.circular=True, it would be if (x isrecursive y) -> x.circular.append
(y), i.e. assocaiting any two "circular" dependencies together, and
then it would sort a graph consisiting of different kinds of objects
instead of just one type as it does now.
Still, the current "circular" code, and a new multiple-class version,
has no way to handle a dependency cycle between two individual
objects. The "circular" code still relies upon a topological sort,
its just that it does it between objects instead of between mappers.
You can, for now, handle whatever relationship you want by skipping
the explicit "relation"s and using MapperExtensions which just handle
the appropriate identifier updates...which is not too different from
just writing the DB code yourself except that it takes effect within
the commit() cycle. it would be nice to have some people test out
MapperExtension to insure that things like this are possible, since
the point of it is to allow all those wacky things SA cant do out of
the box.
Also, if you want to gain some understanding of objectstore, which
would be helpful if you have any ideas to offer, i just committed a
nicer "dependency dump" function. If you turn on
sqlalchemy.mapping.objectstore.LOG = True , youll see a "task dump"
in your standard out that looks like this (if you run examples/
adjacencytree/byroot_tree.py) :
Task dump:
UOWTask(5977456) 'TreeData/treedata'
|
|- UOWDependencyProcessor(5977488) 'data' on UOWTask(5978544)
'TreeNode/treenodes'
| |-TreeNode(5976656).data
| |-TreeNode(5979632).data
| |-TreeNode(5979856).data
| |-TreeNode(5979536).data
| |-TreeNode(5967152).data
|
|- UOWTask(5978544) 'TreeNode/treenodes'->circular->UOWTask
(6009040) 'TreeNode/treenodes'
| |- UOWTask(6009936) 'TreeNode/treenodes'
| | |
| | |- UOWDependencyProcessor(6010192) 'root' on UOWTask
(6009008) '(none)'
| | | |-TreeNode(5976656).root
| | | |-TreeNode(5979632).root
| | | |-TreeNode(5979856).root
| | | |-TreeNode(5979536).root
| | |
| | |
| | |- UOWDependencyProcessor(6010224) 'children' on UOWTask
(6010032) '(none)'
| | | |-TreeNode(5967152).children
| | |
| | |- UOWTask(6009904) 'TreeNode/treenodes'
| | | |- Save: TreeNode(5976656)
| | | |
| | | |- UOWDependencyProcessor(6010320) 'children' on
UOWTask(6009200) '(none)'
| | | | |-TreeNode(5976656).children
| | | |
| | | |- UOWTask(6009360) 'TreeNode/treenodes'
| | | | |- Save: TreeNode(5979856)
| | | | |- Save: TreeNode(5979632)
| | | | |
| | | | |- UOWDependencyProcessor(6010448) 'children' on
UOWTask(6009264) '(none)'
| | | | | |-TreeNode(5979632).children
| | | | |
| | | | |- UOWTask(6009296) 'TreeNode/treenodes'
| | | | | |----
| | | | |
| | | | |- UOWTask(6009104) 'TreeNode/treenodes'
| | | | | |- Save: TreeNode(5979536)
| | | | | |- UOWTask(6008976) 'TreeNode/treenodes'
| | | | | | |----
| | | | | |
| | | | | |----
| | | | |
| | | | |----
| | | |
| | | |----
| | |
| | |----
| |
| |- Delete: TreeNode(5967376)
| |----
|
|- Delete: TreeData(5976368)
|----
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
Sqlalchemy-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users