diff --git a/changelog.md b/changelog.md index a9233f3d..5d024393 100644 --- a/changelog.md +++ b/changelog.md @@ -2,6 +2,7 @@ ## Breaking changes +* Removed `table` property from nodes and relationships returned from `from_snowflake`, the table is represented by the `caption` field. ## New features diff --git a/python-wrapper/src/neo4j_viz/snowflake.py b/python-wrapper/src/neo4j_viz/snowflake.py index 75b43c20..f665c522 100644 --- a/python-wrapper/src/neo4j_viz/snowflake.py +++ b/python-wrapper/src/neo4j_viz/snowflake.py @@ -341,9 +341,9 @@ def from_snowflake( VG = from_dfs(node_dfs, rel_dfs) for node in VG.nodes: - node.caption = node.properties.get("table") + node.caption = node.properties.pop("table") for rel in VG.relationships: - rel.caption = rel.properties.get("table") + rel.caption = rel.properties.pop("table") number_of_colors = node_df["table"].drop_duplicates().count() if number_of_colors <= len(NEO4J_COLORS_DISCRETE): diff --git a/python-wrapper/tests/test_snowflake.py b/python-wrapper/tests/test_snowflake.py index 0cb86ba2..c786b921 100644 --- a/python-wrapper/tests/test_snowflake.py +++ b/python-wrapper/tests/test_snowflake.py @@ -60,8 +60,8 @@ def test_from_snowflake(session_with_minimal_graph: Session) -> None: ) assert VG.nodes == [ - Node(id=0, caption="NODES", color="#ffdf81", properties={"SNOWFLAKEID": 6, "table": "NODES"}), - Node(id=1, caption="NODES", color="#ffdf81", properties={"SNOWFLAKEID": 7, "table": "NODES"}), + Node(id=0, caption="NODES", color="#ffdf81", properties={"SNOWFLAKEID": 6}), + Node(id=1, caption="NODES", color="#ffdf81", properties={"SNOWFLAKEID": 7}), ] assert len(VG.relationships) == 1 @@ -69,4 +69,4 @@ def test_from_snowflake(session_with_minimal_graph: Session) -> None: assert VG.relationships[0].source == 0 assert VG.relationships[0].target == 1 assert VG.relationships[0].caption == "RELS" - assert VG.relationships[0].properties == {"table": "RELS"} + assert VG.relationships[0].properties == {}