@@ -43,6 +43,33 @@ def test_remote_projection(gds_with_cloud_setup: AuraGraphDataScience) -> None:
4343 assert result ["nodeCount" ] == 3
4444
4545
46+ @pytest .mark .cloud_architecture
47+ @pytest .mark .compatible_with (min_inclusive = ServerVersion (2 , 7 , 0 ))
48+ def test_remote_projection_and_writeback_custom_database_name (gds_with_cloud_setup : AuraGraphDataScience ) -> None :
49+ gds_with_cloud_setup .run_cypher ("CREATE DATABASE test1234 IF NOT EXISTS" )
50+ gds_with_cloud_setup .set_database ("test1234" )
51+ gds_with_cloud_setup .run_cypher ("CREATE ()-[:T]->()" )
52+ G , projection_result = gds_with_cloud_setup .graph .project (
53+ GRAPH_NAME , "MATCH (n)-->(m) RETURN gds.graph.project.remote(n, m)"
54+ )
55+
56+ assert G .name () == GRAPH_NAME
57+ assert projection_result ["nodeCount" ] == 2
58+ assert projection_result ["relationshipCount" ] == 1
59+
60+ write_result = gds_with_cloud_setup .wcc .write (G , writeProperty = "wcc" )
61+
62+ assert write_result ["nodePropertiesWritten" ] == 2
63+ count_wcc_nodes_query = "MATCH (n WHERE n.wcc IS NOT NULL) RETURN count(*) AS c"
64+ nodes_with_wcc_custom_db = gds_with_cloud_setup .run_cypher (count_wcc_nodes_query ).squeeze ()
65+ assert nodes_with_wcc_custom_db == 2
66+ gds_with_cloud_setup .set_database ("neo4j" )
67+ # we get a warning because property wcc doesn't exist in the database -- which is good!
68+ with pytest .warns (RuntimeWarning ):
69+ nodes_with_wcc_default_db = gds_with_cloud_setup .run_cypher (count_wcc_nodes_query ).squeeze ()
70+ assert nodes_with_wcc_default_db == 0
71+
72+
4673@pytest .mark .cloud_architecture
4774@pytest .mark .compatible_with (min_inclusive = ServerVersion (2 , 7 , 0 ))
4875def test_remote_projection_with_small_batch_size (gds_with_cloud_setup : AuraGraphDataScience ) -> None :
0 commit comments