[sqlalchemy] Re: Help- Building Join in Graph Structure.

2018-02-07 Thread madhusudan600019
Thank you very much, Jonathan Vanasco. I have not considered backrefs, I will take a look. but, Is there a way to not use backref but directly used these edges (edge_1 and edge_2) to get node_1 and node_3? On Wednesday, February 7, 2018 at 1:42:26 PM UTC-6, Jonathan Vanasco wrote: > >

[sqlalchemy] Re: Help- Building Join in Graph Structure.

2018-02-07 Thread Jonathan Vanasco
actually, you'd be constraining the join against the edge elements since the base is a node. (edge is the more common name for your usage/link) if you're searching for node2, then you'd constrain the query by joining the edge items like this: result = session.query(node_2)\ .join(edge_1,

[sqlalchemy] Re: Help- Building Join in Graph Structure.

2018-02-07 Thread madhusudan600019
What is the efficient way to generalize such joins, If I am parsing a graph and get the joins dynamically? On Wednesday, February 7, 2018 at 1:09:42 PM UTC-6, madhusud...@gmail.com wrote: > > Thank you, Could you elaborate on how would I "constrain the selection > with joins to node1 and

[sqlalchemy] Re: Help- Building Join in Graph Structure.

2018-02-07 Thread madhusudan600019
Thank you, Could you elaborate on how would I "constrain the selection with joins to node1 and node3"? I am still not clear on that part. On Wednesday, February 7, 2018 at 12:57:59 PM UTC-6, Jonathan Vanasco wrote: > > I do a lot with graphs in SqlAlchemy, and I think you'd have a easier time

[sqlalchemy] Re: Help- Building Join in Graph Structure.

2018-02-07 Thread Jonathan Vanasco
I do a lot with graphs in SqlAlchemy, and I think you'd have a easier time writing these queries if you flipped your search so that you're querying a single identified object. For example, on use-case-1, you can query for the "Usage", and join the nodes. > result = session.query(Usage)\ >