python-arango
python-arango copied to clipboard
Edges not retrievable without committing transaction
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()