JanW wrote:
> I am trying to model graph data structure where nodes can be connected
> by different types of edges.
> I would like to encode all this in 2 database tables:
>
> Node table:
>
> Edge table:
>
>
> I think this must be doable using the association_proxy in some way
> (it's vaguely familiar to the Broker/Stock/Holding example in the
> documentation, but now the extra value in the linking table (shares)
> should be used as key in the dictionary) but I can't get it to work.
> Could somebody give me an idea if this is at all possible and maybe a
> push in the right direction?

We have a similar example, minus the "type" part, at
http://www.sqlalchemy.org/trac/browser/sqlalchemy/trunk/examples/graphs/directed_graph.py
.

So here you'd additionally use
collection_class=sqlalchemy.orm.collections.attribute_mapped_collection('edge_type')
for the node->edge collections.   The association proxy can then eliminate
the "edge" traversal between node->node.




>
> Many thanks,
>
> Jan.
>
> --
> 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.
>
>

-- 
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