Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Edges not retrievable without committing transaction #241

Closed
james10424 opened this issue Jan 21, 2023 · 2 comments
Closed

Edges not retrievable without committing transaction #241

james10424 opened this issue Jan 21, 2023 · 2 comments

Comments

@james10424
Copy link

Transaction works with documents, but not edges.

Platform info:

  • os: MacOS 12.6
  • Arango: 3.10.2
  • python-arango: 7.5.5
  • python: 3.10.0

Sample code to reproduce:

def test_transaction():
    client = ArangoClient()
    sys_db = client.db(
        "_system", username="username", password="password"
    )
    # drop and recreate the test db
    sys_db.delete_database("test", ignore_missing=True)
    sys_db.create_database("test")
    db = client.db(
        "test", username="username", password="password"
    )
    # create stuff
    graph = db.create_graph("graph")
    graph.create_vertex_collection("a")
    graph.create_vertex_collection("b")
    edge = graph.create_edge_definition(
        edge_collection="edge",
        from_vertex_collections=["a"],
        to_vertex_collections=["b"],
    )

    tx = db.begin_transaction(
        read=["a", "b", "edge"],
        write=["a", "b", "edge"],
    )
    graph = tx.graph("graph")
    # does not work with regular collection either
    a = graph.vertex_collection("a")
    b = graph.vertex_collection("b")
    a_doc = a.insert({})
    b_doc = b.insert({})
    # verify that they are retrievable without committing
    assert a.get(a_doc["_key"]) is not None
    assert b.get(b_doc["_key"]) is not None
    edge = graph.edge_collection("edge")
    # link a and b
    edge.link(a_doc["_id"], b_doc["_id"])
    edges = edge.edges(a_doc["_id"])
    # this fails without committing
    # tx.commit_transaction()
    assert len(edges["edges"]) == 1
    tx.abort_transaction()
@aMahanna
Copy link
Member

Hey @james10424

Seems that EdgeCollection.edges() (GET /_api/edges/<name>) does not behave the same way as EdgeCollection.get() (GET /_api/gharial/<graph name>/edge/<id>) in terms of transactions.

I can suggest the following for now:

new_edge = edge.link(a_doc["_id"], b_doc["_id"])
assert edge.get(new_edge["_key"]) is not None
# edges = edge.edges(a_doc["_id"])
# assert len(edges["edges"]) == 1

@apetenchea
Copy link
Member

Hey @james10424,

Did the fix suggested by @aMahanna work for you? Are you still experiencing issues?

Since the functionality is already there, I would tend to close this as "Not Planned"

@apetenchea apetenchea closed this as not planned Won't fix, can't repro, duplicate, stale Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants