Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions python-wrapper/src/neo4j_viz/snowflake.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
6 changes: 3 additions & 3 deletions python-wrapper/tests/test_snowflake.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,13 @@ 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

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 == {}