Skip to content

Commit 22b6377

Browse files
authored
Merge pull request #246 from s1ck/snow-22-use-from_snowflake-in-experimentalvisualize
Drop table property key after caption assignment
2 parents 4352dac + fb75418 commit 22b6377

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
## Breaking changes
44

5+
* Removed `table` property from nodes and relationships returned from `from_snowflake`, the table is represented by the `caption` field.
56

67
## New features
78

python-wrapper/src/neo4j_viz/snowflake.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -341,9 +341,9 @@ def from_snowflake(
341341
VG = from_dfs(node_dfs, rel_dfs)
342342

343343
for node in VG.nodes:
344-
node.caption = node.properties.get("table")
344+
node.caption = node.properties.pop("table")
345345
for rel in VG.relationships:
346-
rel.caption = rel.properties.get("table")
346+
rel.caption = rel.properties.pop("table")
347347

348348
number_of_colors = node_df["table"].drop_duplicates().count()
349349
if number_of_colors <= len(NEO4J_COLORS_DISCRETE):

python-wrapper/tests/test_snowflake.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,13 @@ def test_from_snowflake(session_with_minimal_graph: Session) -> None:
6060
)
6161

6262
assert VG.nodes == [
63-
Node(id=0, caption="NODES", color="#ffdf81", properties={"SNOWFLAKEID": 6, "table": "NODES"}),
64-
Node(id=1, caption="NODES", color="#ffdf81", properties={"SNOWFLAKEID": 7, "table": "NODES"}),
63+
Node(id=0, caption="NODES", color="#ffdf81", properties={"SNOWFLAKEID": 6}),
64+
Node(id=1, caption="NODES", color="#ffdf81", properties={"SNOWFLAKEID": 7}),
6565
]
6666

6767
assert len(VG.relationships) == 1
6868

6969
assert VG.relationships[0].source == 0
7070
assert VG.relationships[0].target == 1
7171
assert VG.relationships[0].caption == "RELS"
72-
assert VG.relationships[0].properties == {"table": "RELS"}
72+
assert VG.relationships[0].properties == {}

0 commit comments

Comments
 (0)