pyneoinstance 2.2.0__tar.gz → 4.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pyneoinstance-2.2.0 → pyneoinstance-4.0.0}/MANIFEST.in +1 -1
- {pyneoinstance-2.2.0/pyneoinstance.egg-info → pyneoinstance-4.0.0}/PKG-INFO +67 -27
- {pyneoinstance-2.2.0 → pyneoinstance-4.0.0}/README.md +51 -19
- {pyneoinstance-2.2.0 → pyneoinstance-4.0.0}/pyneoinstance/__init__.py +2 -2
- pyneoinstance-4.0.0/pyneoinstance/database/context.py +6 -0
- {pyneoinstance-2.2.0 → pyneoinstance-4.0.0}/pyneoinstance/database/neo4jdbms.py +209 -259
- {pyneoinstance-2.2.0 → pyneoinstance-4.0.0}/pyneoinstance/fileload/helpers.py +3 -3
- {pyneoinstance-2.2.0 → pyneoinstance-4.0.0}/pyneoinstance/fileload/loadyaml.py +1 -1
- pyneoinstance-4.0.0/pyneoinstance/py.typed +0 -0
- {pyneoinstance-2.2.0 → pyneoinstance-4.0.0}/pyneoinstance/util/__init__.py +2 -1
- {pyneoinstance-2.2.0 → pyneoinstance-4.0.0}/pyneoinstance/util/functions.py +20 -18
- {pyneoinstance-2.2.0 → pyneoinstance-4.0.0/pyneoinstance.egg-info}/PKG-INFO +67 -27
- {pyneoinstance-2.2.0 → pyneoinstance-4.0.0}/pyneoinstance.egg-info/SOURCES.txt +2 -1
- pyneoinstance-4.0.0/pyneoinstance.egg-info/requires.txt +8 -0
- pyneoinstance-4.0.0/pyneoinstance.egg-info/top_level.txt +5 -0
- pyneoinstance-4.0.0/pyproject.toml +43 -0
- pyneoinstance-4.0.0/setup.py +5 -0
- pyneoinstance-4.0.0/test/age_data.csv +300001 -0
- {pyneoinstance-2.2.0 → pyneoinstance-4.0.0}/test/context.py +1 -1
- pyneoinstance-4.0.0/test/test_neo4jdb.py +237 -0
- {pyneoinstance-2.2.0 → pyneoinstance-4.0.0}/test/test_util_functions.py +24 -10
- pyneoinstance-2.2.0/pyneoinstance/database/context.py +0 -6
- pyneoinstance-2.2.0/pyneoinstance/fileload/context.py +0 -6
- pyneoinstance-2.2.0/pyneoinstance.egg-info/requires.txt +0 -4
- pyneoinstance-2.2.0/pyneoinstance.egg-info/top_level.txt +0 -2
- pyneoinstance-2.2.0/pyproject.toml +0 -26
- pyneoinstance-2.2.0/setup.py +0 -5
- pyneoinstance-2.2.0/test/test_neo4jdb.py +0 -202
- {pyneoinstance-2.2.0 → pyneoinstance-4.0.0}/LICENSE +0 -0
- {pyneoinstance-2.2.0 → pyneoinstance-4.0.0}/pyneoinstance/database/__init__.py +0 -0
- {pyneoinstance-2.2.0 → pyneoinstance-4.0.0}/pyneoinstance/fileload/__init__.py +0 -0
- {pyneoinstance-2.2.0 → pyneoinstance-4.0.0}/pyneoinstance.egg-info/dependency_links.txt +0 -0
- {pyneoinstance-2.2.0 → pyneoinstance-4.0.0}/setup.cfg +0 -0
- {pyneoinstance-2.2.0 → pyneoinstance-4.0.0}/test/__init__.py +0 -0
- {pyneoinstance-2.2.0 → pyneoinstance-4.0.0}/test/cypher_queries.yaml +0 -0
- {pyneoinstance-2.2.0 → pyneoinstance-4.0.0}/test/load_files.yaml +0 -0
- {pyneoinstance-2.2.0 → pyneoinstance-4.0.0}/test/movies.csv +0 -0
- {pyneoinstance-2.2.0 → pyneoinstance-4.0.0}/test/people.csv +0 -0
- {pyneoinstance-2.2.0 → pyneoinstance-4.0.0}/test/roles.csv +0 -0
- {pyneoinstance-2.2.0 → pyneoinstance-4.0.0}/test/test.py +0 -0
- {pyneoinstance-2.2.0 → pyneoinstance-4.0.0}/test/test_fileload.py +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pyneoinstance
|
|
3
|
-
Version:
|
|
4
|
-
Summary: Handle Neo4j read and write transactions and provide
|
|
3
|
+
Version: 4.0.0
|
|
4
|
+
Summary: Handle Neo4j read and write transactions and provide methods for performing graph EDA
|
|
5
5
|
Author-email: "Jose A. Alvarado-Guzman" <jose.alvarado-guzman@neo4j.com>
|
|
6
6
|
License: GNU GENERAL PUBLIC LICENSE
|
|
7
7
|
Version 3, 29 June 2007
|
|
@@ -678,21 +678,34 @@ License: GNU GENERAL PUBLIC LICENSE
|
|
|
678
678
|
Public License instead of this License. But first, please read
|
|
679
679
|
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
|
680
680
|
|
|
681
|
+
Project-URL: Repository, https://github.com/jose-alvarado-guzman/pyneoingest
|
|
682
|
+
Project-URL: Documentation, https://jose-alvarado-guzman.github.io/pyneoingest/
|
|
681
683
|
Keywords: neo4j,graph,cypher
|
|
682
|
-
Classifier: License :: OSI Approved :: GNU General Public License (
|
|
684
|
+
Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
|
|
683
685
|
Classifier: Programming Language :: Python :: 3
|
|
684
|
-
Classifier:
|
|
685
|
-
|
|
686
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
687
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
688
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
689
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
690
|
+
Requires-Python: >=3.10
|
|
686
691
|
Description-Content-Type: text/markdown
|
|
687
692
|
License-File: LICENSE
|
|
688
|
-
Requires-Dist: neo4j>=5.0.0
|
|
689
|
-
Requires-Dist: pandas
|
|
690
|
-
Requires-Dist: PyYAML
|
|
691
|
-
Requires-Dist: pyvis
|
|
693
|
+
Requires-Dist: neo4j-rust-ext>=5.0.0
|
|
694
|
+
Requires-Dist: pandas>=1.3.0
|
|
695
|
+
Requires-Dist: PyYAML>=5.1
|
|
696
|
+
Requires-Dist: pyvis>=0.3.0
|
|
697
|
+
Requires-Dist: neo4j-viz>=0.5.0
|
|
698
|
+
Provides-Extra: docs
|
|
699
|
+
Requires-Dist: mkdocs-material>=9.0.0; extra == "docs"
|
|
692
700
|
Dynamic: license-file
|
|
693
701
|
|
|
694
702
|
# PyNeoInstance Package
|
|
695
703
|
|
|
704
|
+
<table>
|
|
705
|
+
<tr>
|
|
706
|
+
<td><img src="https://raw.githubusercontent.com/jose-alvarado-guzman/pyneoingest/main/images/PyNeoInstanceLogo.png" alt="PyNeoInstance Logo" width="300"></td>
|
|
707
|
+
<td valign="top">
|
|
708
|
+
|
|
696
709
|
## What is it?
|
|
697
710
|
|
|
698
711
|
PyNeoInstance is a Python package that provides a user friendly API for submitting Cypher queries to Neo4j and performing Exploratory Data Analysis (EDA) of your graph.
|
|
@@ -712,14 +725,25 @@ It supports the following features:
|
|
|
712
725
|
- __<u>Constraints</u>__: Get information of all constraints in the graph.
|
|
713
726
|
- __<u>Indexes</u>__: Get information of all indexes in the graph.
|
|
714
727
|
- __<u>Schema Visualization</u>__: Visualize the graph schema.
|
|
728
|
+
- __<u>Query Graph Visualization</u>__: Visualize the result of a Cypher query as an interactive graph.
|
|
729
|
+
|
|
730
|
+
</td>
|
|
731
|
+
</tr>
|
|
732
|
+
</table>
|
|
733
|
+
|
|
715
734
|
|
|
735
|
+
## Documentation
|
|
736
|
+
|
|
737
|
+
Full documentation is available at **https://jose-alvarado-guzman.github.io/pyneoingest/**
|
|
716
738
|
|
|
717
739
|
## How to install it?
|
|
718
740
|
|
|
719
|
-
```
|
|
741
|
+
```bash
|
|
720
742
|
pip install pyneoinstance
|
|
721
743
|
```
|
|
722
744
|
|
|
745
|
+
The Rust-accelerated Neo4j driver (`neo4j-rust-ext`) is included by default for faster data serialization.
|
|
746
|
+
|
|
723
747
|
## How to use it?
|
|
724
748
|
|
|
725
749
|
### Instantiating the Neo4jInstance class
|
|
@@ -801,7 +825,7 @@ query = """
|
|
|
801
825
|
m.tagline AS tagline;
|
|
802
826
|
"""
|
|
803
827
|
|
|
804
|
-
data = graph.execute_read_query(query, db_info['database'],
|
|
828
|
+
data = graph.execute_read_query(query, db_info['database'], parameters={'movie_title':'The Matrix'})
|
|
805
829
|
```
|
|
806
830
|
|
|
807
831
|
### Submitting a Cypher write query
|
|
@@ -818,9 +842,9 @@ query = """
|
|
|
818
842
|
|
|
819
843
|
results = graph.execute_write_query(query, db_info['database'],
|
|
820
844
|
parameters={
|
|
821
|
-
'movie_title':'Wakanda Forever',
|
|
822
|
-
'year'
|
|
823
|
-
tagline
|
|
845
|
+
'movie_title': 'Wakanda Forever',
|
|
846
|
+
'year': 2022,
|
|
847
|
+
'tagline': 'Wakanda Forever! Long Live Wakanda! For Honor, For Legacy, For Wakanda!'
|
|
824
848
|
})
|
|
825
849
|
```
|
|
826
850
|
|
|
@@ -830,7 +854,7 @@ We can update a Neo4j database with data contained in a Pandas Data Frame using
|
|
|
830
854
|
|
|
831
855
|
- _data_: Pandas Data Frame containing data to process.
|
|
832
856
|
- _database_: Optional, database on which to execute the queries.
|
|
833
|
-
-
|
|
857
|
+
- _batchSize_: Optional, number of records per batch use to break the Data Frame in smaller chucks.
|
|
834
858
|
- _parallel_: Whether to execute the query using multiple Python process.
|
|
835
859
|
- _workers_: The number of processes to spawn to execute the queries in parallel.
|
|
836
860
|
- _parameters_: Extra arguments containing optional cypher parameters.
|
|
@@ -910,25 +934,25 @@ node_load_queries = config['loading_queries']['nodes']
|
|
|
910
934
|
person_load_result = graph.execute_write_query_with_data(node_load_queries['Person'], person_data, db_info['database'])
|
|
911
935
|
```
|
|
912
936
|
|
|
913
|
-
If the number of rows in your Data Frame is 100K or more it is recommended to break the Data Frame in smaller chunks so that they can be process in different transactions. This will avoid running out of heap error. To do this, just indicate in the
|
|
937
|
+
If the number of rows in your Data Frame is 100K or more it is recommended to break the Data Frame in smaller chunks so that they can be process in different transactions. This will avoid running out of heap error. To do this, just indicate in the _batchSize_ argument the number of records per data batch to break this Data Frame into smaller data batches. These partitions will be loaded in different sequential transactions unless you specified loading them in parallel by setting the _parallel_ argument to true. We will discuss this process in the next section.
|
|
914
938
|
|
|
915
939
|
```python
|
|
916
940
|
person_load_result = graph.execute_write_query_with_data(
|
|
917
941
|
node_load_queries['person'],
|
|
918
942
|
person_data,
|
|
919
943
|
db_info['database'],
|
|
920
|
-
|
|
944
|
+
batchSize = 100000
|
|
921
945
|
)
|
|
922
946
|
```
|
|
923
947
|
## Updating a database with data in a Data Frame: Parallel
|
|
924
948
|
|
|
925
|
-
To load the data in the Data Frame in parallel, we need to partition the Data Frame by incrementing the
|
|
949
|
+
To load the data in the Data Frame in parallel, we need to partition the Data Frame by incrementing the _batchSize_ argument and set the _parallel_ argument to true. By default, this will use all the available virtual CPUs in the machine. If you need to use less, you can specify how many to use by setting the _workers_ argument.
|
|
926
950
|
|
|
927
951
|
```python
|
|
928
952
|
person_load_result = graph.execute_write_query_with_data(
|
|
929
953
|
node_load_queries['person'],
|
|
930
954
|
person_data,
|
|
931
|
-
|
|
955
|
+
batchSize = 100000,
|
|
932
956
|
parallel = True,
|
|
933
957
|
workers = 5
|
|
934
958
|
)
|
|
@@ -959,7 +983,7 @@ graph.get_rela_type_freq(database='mydbname')
|
|
|
959
983
|
### Properties
|
|
960
984
|
The get_properties method provides information about all the nodes and relationships properties.
|
|
961
985
|
```python
|
|
962
|
-
graph.
|
|
986
|
+
graph.get_properties(database='mydbname')
|
|
963
987
|
```
|
|
964
988
|
<img src="https://s3.amazonaws.com/neo4j-ps-ds-bootcamp/img/properties.png" width="350" hight="300">
|
|
965
989
|
|
|
@@ -977,21 +1001,37 @@ graph.get_indexes(database='mydbname')
|
|
|
977
1001
|
```
|
|
978
1002
|
<img src="https://s3.amazonaws.com/neo4j-ps-ds-bootcamp/img/indexes.png" width="450" hight="400">
|
|
979
1003
|
|
|
980
|
-
###
|
|
981
|
-
The
|
|
1004
|
+
### Query Graph Visualization
|
|
1005
|
+
The `get_query_visualization` method executes a Cypher query that returns nodes and relationships and renders the result as an interactive graph. Node labels are displayed as captions and all properties appear as tooltips on hover.
|
|
982
1006
|
|
|
983
1007
|
```python
|
|
984
|
-
|
|
985
|
-
|
|
1008
|
+
query = """
|
|
1009
|
+
MATCH (p:Person)-[r:ACTED_IN]->(m:Movie)
|
|
1010
|
+
RETURN p, r, m
|
|
1011
|
+
LIMIT 50
|
|
1012
|
+
"""
|
|
1013
|
+
vg = graph.get_query_visualization(query, database='mydbname')
|
|
1014
|
+
|
|
1015
|
+
# In a Jupyter notebook — renders inline:
|
|
1016
|
+
vg.render()
|
|
1017
|
+
|
|
1018
|
+
# As a standalone HTML file:
|
|
1019
|
+
with open('graph.html', 'w') as f:
|
|
1020
|
+
f.write(f'<!DOCTYPE html><html><body>{vg.render().data}</body></html>')
|
|
986
1021
|
```
|
|
987
|
-
<img src="https://
|
|
1022
|
+
<img src="https://raw.githubusercontent.com/jose-alvarado-guzman/pyneoingest/main/images/query_visualization.png" alt="Query Graph Visualization" width="600">
|
|
988
1023
|
|
|
989
|
-
|
|
1024
|
+
### Schema Visualization
|
|
1025
|
+
The `get_schema_visualization` method provides an interactive visualization of the graph schema with the ability to filter by label. Node labels are displayed as strings next to nodes; relationship types are shown on mouse hover.
|
|
990
1026
|
|
|
991
1027
|
```python
|
|
992
1028
|
schema = graph.get_schema_visualization(database='mydbname')
|
|
993
|
-
schema.
|
|
1029
|
+
schema.write_html('schema.html')
|
|
994
1030
|
```
|
|
1031
|
+
|
|
1032
|
+
Open `schema.html` in your browser to explore the schema interactively.
|
|
1033
|
+
|
|
1034
|
+
<img src="https://s3.amazonaws.com/neo4j-ps-ds-bootcamp/img/schema.png" width="450" hight="400">
|
|
995
1035
|
<img src="https://s3.amazonaws.com/neo4j-ps-ds-bootcamp/img/schemaHtml.png" width="450" hight="400">
|
|
996
1036
|
|
|
997
1037
|
## More detailed examples
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
# PyNeoInstance Package
|
|
2
2
|
|
|
3
|
+
<table>
|
|
4
|
+
<tr>
|
|
5
|
+
<td><img src="https://raw.githubusercontent.com/jose-alvarado-guzman/pyneoingest/main/images/PyNeoInstanceLogo.png" alt="PyNeoInstance Logo" width="300"></td>
|
|
6
|
+
<td valign="top">
|
|
7
|
+
|
|
3
8
|
## What is it?
|
|
4
9
|
|
|
5
10
|
PyNeoInstance is a Python package that provides a user friendly API for submitting Cypher queries to Neo4j and performing Exploratory Data Analysis (EDA) of your graph.
|
|
@@ -19,14 +24,25 @@ It supports the following features:
|
|
|
19
24
|
- __<u>Constraints</u>__: Get information of all constraints in the graph.
|
|
20
25
|
- __<u>Indexes</u>__: Get information of all indexes in the graph.
|
|
21
26
|
- __<u>Schema Visualization</u>__: Visualize the graph schema.
|
|
27
|
+
- __<u>Query Graph Visualization</u>__: Visualize the result of a Cypher query as an interactive graph.
|
|
28
|
+
|
|
29
|
+
</td>
|
|
30
|
+
</tr>
|
|
31
|
+
</table>
|
|
32
|
+
|
|
22
33
|
|
|
34
|
+
## Documentation
|
|
35
|
+
|
|
36
|
+
Full documentation is available at **https://jose-alvarado-guzman.github.io/pyneoingest/**
|
|
23
37
|
|
|
24
38
|
## How to install it?
|
|
25
39
|
|
|
26
|
-
```
|
|
40
|
+
```bash
|
|
27
41
|
pip install pyneoinstance
|
|
28
42
|
```
|
|
29
43
|
|
|
44
|
+
The Rust-accelerated Neo4j driver (`neo4j-rust-ext`) is included by default for faster data serialization.
|
|
45
|
+
|
|
30
46
|
## How to use it?
|
|
31
47
|
|
|
32
48
|
### Instantiating the Neo4jInstance class
|
|
@@ -108,7 +124,7 @@ query = """
|
|
|
108
124
|
m.tagline AS tagline;
|
|
109
125
|
"""
|
|
110
126
|
|
|
111
|
-
data = graph.execute_read_query(query, db_info['database'],
|
|
127
|
+
data = graph.execute_read_query(query, db_info['database'], parameters={'movie_title':'The Matrix'})
|
|
112
128
|
```
|
|
113
129
|
|
|
114
130
|
### Submitting a Cypher write query
|
|
@@ -125,9 +141,9 @@ query = """
|
|
|
125
141
|
|
|
126
142
|
results = graph.execute_write_query(query, db_info['database'],
|
|
127
143
|
parameters={
|
|
128
|
-
'movie_title':'Wakanda Forever',
|
|
129
|
-
'year'
|
|
130
|
-
tagline
|
|
144
|
+
'movie_title': 'Wakanda Forever',
|
|
145
|
+
'year': 2022,
|
|
146
|
+
'tagline': 'Wakanda Forever! Long Live Wakanda! For Honor, For Legacy, For Wakanda!'
|
|
131
147
|
})
|
|
132
148
|
```
|
|
133
149
|
|
|
@@ -137,7 +153,7 @@ We can update a Neo4j database with data contained in a Pandas Data Frame using
|
|
|
137
153
|
|
|
138
154
|
- _data_: Pandas Data Frame containing data to process.
|
|
139
155
|
- _database_: Optional, database on which to execute the queries.
|
|
140
|
-
-
|
|
156
|
+
- _batchSize_: Optional, number of records per batch use to break the Data Frame in smaller chucks.
|
|
141
157
|
- _parallel_: Whether to execute the query using multiple Python process.
|
|
142
158
|
- _workers_: The number of processes to spawn to execute the queries in parallel.
|
|
143
159
|
- _parameters_: Extra arguments containing optional cypher parameters.
|
|
@@ -217,25 +233,25 @@ node_load_queries = config['loading_queries']['nodes']
|
|
|
217
233
|
person_load_result = graph.execute_write_query_with_data(node_load_queries['Person'], person_data, db_info['database'])
|
|
218
234
|
```
|
|
219
235
|
|
|
220
|
-
If the number of rows in your Data Frame is 100K or more it is recommended to break the Data Frame in smaller chunks so that they can be process in different transactions. This will avoid running out of heap error. To do this, just indicate in the
|
|
236
|
+
If the number of rows in your Data Frame is 100K or more it is recommended to break the Data Frame in smaller chunks so that they can be process in different transactions. This will avoid running out of heap error. To do this, just indicate in the _batchSize_ argument the number of records per data batch to break this Data Frame into smaller data batches. These partitions will be loaded in different sequential transactions unless you specified loading them in parallel by setting the _parallel_ argument to true. We will discuss this process in the next section.
|
|
221
237
|
|
|
222
238
|
```python
|
|
223
239
|
person_load_result = graph.execute_write_query_with_data(
|
|
224
240
|
node_load_queries['person'],
|
|
225
241
|
person_data,
|
|
226
242
|
db_info['database'],
|
|
227
|
-
|
|
243
|
+
batchSize = 100000
|
|
228
244
|
)
|
|
229
245
|
```
|
|
230
246
|
## Updating a database with data in a Data Frame: Parallel
|
|
231
247
|
|
|
232
|
-
To load the data in the Data Frame in parallel, we need to partition the Data Frame by incrementing the
|
|
248
|
+
To load the data in the Data Frame in parallel, we need to partition the Data Frame by incrementing the _batchSize_ argument and set the _parallel_ argument to true. By default, this will use all the available virtual CPUs in the machine. If you need to use less, you can specify how many to use by setting the _workers_ argument.
|
|
233
249
|
|
|
234
250
|
```python
|
|
235
251
|
person_load_result = graph.execute_write_query_with_data(
|
|
236
252
|
node_load_queries['person'],
|
|
237
253
|
person_data,
|
|
238
|
-
|
|
254
|
+
batchSize = 100000,
|
|
239
255
|
parallel = True,
|
|
240
256
|
workers = 5
|
|
241
257
|
)
|
|
@@ -266,7 +282,7 @@ graph.get_rela_type_freq(database='mydbname')
|
|
|
266
282
|
### Properties
|
|
267
283
|
The get_properties method provides information about all the nodes and relationships properties.
|
|
268
284
|
```python
|
|
269
|
-
graph.
|
|
285
|
+
graph.get_properties(database='mydbname')
|
|
270
286
|
```
|
|
271
287
|
<img src="https://s3.amazonaws.com/neo4j-ps-ds-bootcamp/img/properties.png" width="350" hight="300">
|
|
272
288
|
|
|
@@ -284,25 +300,41 @@ graph.get_indexes(database='mydbname')
|
|
|
284
300
|
```
|
|
285
301
|
<img src="https://s3.amazonaws.com/neo4j-ps-ds-bootcamp/img/indexes.png" width="450" hight="400">
|
|
286
302
|
|
|
287
|
-
###
|
|
288
|
-
The
|
|
303
|
+
### Query Graph Visualization
|
|
304
|
+
The `get_query_visualization` method executes a Cypher query that returns nodes and relationships and renders the result as an interactive graph. Node labels are displayed as captions and all properties appear as tooltips on hover.
|
|
289
305
|
|
|
290
306
|
```python
|
|
291
|
-
|
|
292
|
-
|
|
307
|
+
query = """
|
|
308
|
+
MATCH (p:Person)-[r:ACTED_IN]->(m:Movie)
|
|
309
|
+
RETURN p, r, m
|
|
310
|
+
LIMIT 50
|
|
311
|
+
"""
|
|
312
|
+
vg = graph.get_query_visualization(query, database='mydbname')
|
|
313
|
+
|
|
314
|
+
# In a Jupyter notebook — renders inline:
|
|
315
|
+
vg.render()
|
|
316
|
+
|
|
317
|
+
# As a standalone HTML file:
|
|
318
|
+
with open('graph.html', 'w') as f:
|
|
319
|
+
f.write(f'<!DOCTYPE html><html><body>{vg.render().data}</body></html>')
|
|
293
320
|
```
|
|
294
|
-
<img src="https://
|
|
321
|
+
<img src="https://raw.githubusercontent.com/jose-alvarado-guzman/pyneoingest/main/images/query_visualization.png" alt="Query Graph Visualization" width="600">
|
|
295
322
|
|
|
296
|
-
|
|
323
|
+
### Schema Visualization
|
|
324
|
+
The `get_schema_visualization` method provides an interactive visualization of the graph schema with the ability to filter by label. Node labels are displayed as strings next to nodes; relationship types are shown on mouse hover.
|
|
297
325
|
|
|
298
326
|
```python
|
|
299
327
|
schema = graph.get_schema_visualization(database='mydbname')
|
|
300
|
-
schema.
|
|
328
|
+
schema.write_html('schema.html')
|
|
301
329
|
```
|
|
330
|
+
|
|
331
|
+
Open `schema.html` in your browser to explore the schema interactively.
|
|
332
|
+
|
|
333
|
+
<img src="https://s3.amazonaws.com/neo4j-ps-ds-bootcamp/img/schema.png" width="450" hight="400">
|
|
302
334
|
<img src="https://s3.amazonaws.com/neo4j-ps-ds-bootcamp/img/schemaHtml.png" width="450" hight="400">
|
|
303
335
|
|
|
304
336
|
## More detailed examples
|
|
305
337
|
|
|
306
338
|
For more detailed examples please refer to the following articles:
|
|
307
339
|
* Data ingestion: [PyNeoInstance: A User-Friendly Python Library for Neo4j](https://medium.com/@a-gilmore/pyneoinstance-a-user-friendly-python-library-for-neo4j-dbefa3117bb2).
|
|
308
|
-
* Graph EDA: [Performing graph EDA with the PyNeoInstance Python Package](https://medium.com/@jose.alvarado-guzman/0c0f6f230aa9)
|
|
340
|
+
* Graph EDA: [Performing graph EDA with the PyNeoInstance Python Package](https://medium.com/@jose.alvarado-guzman/0c0f6f230aa9)
|