Skip to content

Commit d9fc752

Browse files
Merge pull request #376 from soerenreichardt/arrow-remote-write-back
Arrow remote write back
2 parents f69a920 + 10f89ff commit d9fc752

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

graphdatascience/query_runner/aura_db_arrow_query_runner.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,17 @@ def run_query(
6666
params["host"] = aura_db_arrow_endpoint
6767
params["config"] = {"useEncryption": False}
6868

69+
elif ".write" in query and "config" in params and "remote" in params["config"] and params["config"]["remote"]:
70+
token, aura_db_arrow_endpoint = self._get_or_request_auth_pair()
71+
host, port_string = aura_db_arrow_endpoint.split(":")
72+
del params["config"]["remote"]
73+
params["config"]["arrowConnectionInfo"] = {
74+
"hostname": host,
75+
"port": int(port_string),
76+
"bearerToken": token,
77+
"useEncryption": False,
78+
}
79+
6980
return self._fallback_query_runner.run_query(query, params, database, custom_error)
7081

7182
def set_database(self, database: str) -> None:

graphdatascience/tests/integration/test_remote_graph_ops.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,15 @@ def test_remote_projection(gds_with_cloud_setup: GraphDataScience) -> None:
4343

4444
assert G.name() == GRAPH_NAME
4545
assert result["nodeCount"] == 3
46+
47+
48+
@pytest.mark.cloud_architecture
49+
@pytest.mark.compatible_with(min_inclusive=ServerVersion(2, 4, 0))
50+
def test_remote_write_back(gds_with_cloud_setup: GraphDataScience) -> None:
51+
G, result = gds_with_cloud_setup.alpha.graph.project.remote(
52+
GRAPH_NAME, "MATCH (n)-->(m) RETURN n as sourceNode, m as targetNode", "neo4j"
53+
)
54+
55+
result = gds_with_cloud_setup.pageRank.write(G, writeProperty="score", remote=True)
56+
57+
assert result["nodePropertiesWritten"] == 3

0 commit comments

Comments
 (0)