Skip to content

Commit d91c1f3

Browse files
committed
Revamp snowflake example notebook
1 parent 75dada6 commit d91c1f3

File tree

7 files changed

+567
-393
lines changed

7 files changed

+567
-393
lines changed

docs/source/integration.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Pandas DataFrames
1919
-----------------
2020

2121
The ``neo4j-viz`` library provides a convenience method for importing data from Pandas DataFrames.
22-
These DataFrames can be created from many sources, such as CSV files or :doc:`Snowflake tables<./tutorials/snowpark-example>`.
22+
These DataFrames can be created from many sources, such as CSV files or :doc:`Snowflake tables<./tutorials/snowflake-example>`.
2323
It requires and additional dependency to be installed, which you can do by running:
2424

2525
.. code-block:: bash
@@ -83,7 +83,7 @@ and :doc:`Relationships <./api-reference/relationship>`.
8383
VG = from_dfs(nodes, relationships)
8484
8585
For another example of the ``from_dfs`` importer in action, see the
86-
:doc:`Visualizing Snowflake Tables tutorial <./tutorials/snowpark-example>`.
86+
:doc:`Visualizing Snowflake Tables tutorial <./tutorials/snowflake-example>`.
8787

8888

8989
Neo4j Graph Data Science (GDS) library
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"path": "../../../examples/snowflake-example.ipynb"
3+
}

docs/source/tutorials/snowpark-example.nblink

Lines changed: 0 additions & 3 deletions
This file was deleted.

examples/snowflake-example.ipynb

Lines changed: 554 additions & 0 deletions
Large diffs are not rendered by default.

examples/snowpark-example.ipynb

Lines changed: 0 additions & 387 deletions
This file was deleted.

python-wrapper/src/neo4j_viz/snowflake.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
)
3838

3939
from neo4j_viz import VisualizationGraph
40+
from neo4j_viz.colors import ColorSpace
4041
from neo4j_viz.pandas import from_dfs
4142

4243

@@ -336,4 +337,8 @@ def from_snowflake(
336337
for i, rel_df in enumerate(rel_dfs):
337338
rel_df["caption"] = rel_table_names[i].split(".")[-1]
338339

339-
return from_dfs(node_dfs, rel_dfs, node_radius_min_max)
340+
VG = from_dfs(node_dfs, rel_dfs, node_radius_min_max)
341+
342+
VG.color_nodes(field="caption", color_space=ColorSpace.DISCRETE)
343+
344+
return VG

python-wrapper/tests/test_snowflake.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,12 @@ def test_from_snowflake(session_with_minimal_graph: Session) -> None:
6262

6363
assert VG.nodes[0].id == 0
6464
assert VG.nodes[0].caption == "NODES"
65+
assert VG.nodes[0].color is not None
6566
assert VG.nodes[0].properties == {"SNOWFLAKEID": 6}
6667

6768
assert VG.nodes[1].id == 1
6869
assert VG.nodes[1].caption == "NODES"
70+
assert VG.nodes[0].color is not None
6971
assert VG.nodes[1].properties == {"SNOWFLAKEID": 7}
7072

7173
assert len(VG.relationships) == 1

0 commit comments

Comments
 (0)