Skip to content

Commit e938f75

Browse files
committed
add python copy example
1 parent 74b9586 commit e938f75

File tree

1 file changed

+25
-4
lines changed

1 file changed

+25
-4
lines changed

commands/graph.copy.md

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@ The `GRAPH.COPY` command creates a copy of a graph, while the copy is performed
1313
the `src` graph is fully accessible.
1414

1515
Example:
16-
```
17-
127.0.0.1:6379> keys *
16+
17+
{% capture shell_0 %}
18+
127.0.0.1:6379> GRAPH.LIST
1819
(empty array)
1920
127.0.0.1:6379> GRAPH.QUERY A "CREATE (:Account {number: 516637})"
2021
1) 1) "Labels added: 1"
@@ -24,7 +25,7 @@ Example:
2425
5) "Query internal execution time: 0.588084 milliseconds"
2526
127.0.0.1:6379> GRAPH.COPY A Z
2627
"OK"
27-
127.0.0.1:6379> keys *
28+
127.0.0.1:6379> GRAPH.LIST
2829
1) "Z"
2930
2) "telemetry{A}"
3031
3) "A"
@@ -33,4 +34,24 @@ Example:
3334
2) 1) 1) (integer) 516637
3435
3) 1) "Cached execution: 0"
3536
2) "Query internal execution time: 0.638375 milliseconds"
36-
```
37+
{% endcapture %}
38+
39+
{% capture python_0 %}
40+
# Graphs list is empty
41+
graph_list = db.list()
42+
43+
# Create Graph 'A'
44+
graph_a = db.select_graph('A')
45+
result = graph_a.query('CREATE (:Account {number: 516637})')
46+
47+
# Copy Graph 'A' to 'Z'
48+
graph_z = graph_a.copy('A', 'Z')
49+
50+
# Graphs list including 'A' and 'Z'
51+
graph_list = db.list()
52+
53+
# Query Graph 'Z'
54+
result = graph_z.query('MATCH (a:Account) RETURN a.number')
55+
{% endcapture %}
56+
57+
{% include code_tabs.html id="tabs_0" shell=shell_0 python=python_0 %}

0 commit comments

Comments
 (0)