pygraphistry icon indicating copy to clipboard operation
pygraphistry copied to clipboard

ArrowInvalid error in g.plot() after retrieving data from memgraph using graphistry.cypher()

Open DataBoyTX opened this issue 1 year ago • 0 comments

Describe the bug

User reports ArrowInvalid error in g.plot() after retrieving data from memgraph using graphistry.cypher() - running from databricks notebook

g.plot() results in:

ArrowInvalid 'Could not convert "SomeString" with type str: tried to convert int64. Conversion failed for column id with type Object.

To Reproduce

  1. set up memgraph
curl https://install.memgraph.com | sh
  1. log into memgraph ui at http://memgraph-server:3000/

  2. Manually add nodes for testing with the following cypher queries (unable to reproduce the error with this data, but important that the id fields are strings)

// Create nodes
MERGE (node1:Node {id: "1-abc"})
MERGE (node2:Node {id: "2-def"})
MERGE (node3:Node {id: "3-abc"})
MERGE (node4:Node {id: "4-def"})

// Create edges
MERGE (node1)-[:RELATIONSHIP {id: "e1-123"}]->(node2)
MERGE (node3)-[:RELATIONSHIP {id: "e2-123"}]->(node4)
MERGE (node1)-[:RELATIONSHIP {id: "e123"}]->(node4)
  1. load the following code into a databricks notebook:
#!pip install neo4j
#!pip install graphistry 

## make sure to restart kernel after pip install 

import awswrangler as wr
import pandas as pd
import graphistry
import neo4j
print(graphistry.__version__)
print(neo4j.__version__)

#graphistry.register(api=3, username="...", password="...", protocol="...", server="...")  

# update with your cypher endpoint name: 
url='memgraph_server_name'  

## Connect to Memgraph using pygraphistry bolt connector

from neo4j import GraphDatabase
uri = f"bolt://{url}:7687"

#driver = GraphDatabase.driver(uri, auth=("ignored", "ignored"), encrypted=True)
driver = GraphDatabase.driver(uri, auth=("ignored", "ignored"), encrypted=False)

graphistry.register(bolt=driver)

g = graphistry.cypher("MATCH (a:Node)-[e]->(b) return a,e,b ")

g.plot()  # results in error 

# troubleshooting: 

g._edges.head(3)
g._nodes.head(3)
g._nodes.dtypes
g._edges.dtypes
g._node, g._source, g._destination

Expected behavior g.plot() should not error and should handle the conversion of the id field to int64

Actual behavior see error above

Screenshots

Browser environment (please complete the following information): waiting for the details

Graphistry GPU server environment waiting for the details

PyGraphistry API client environment waiting for the details

Additional context Running from databricks, connecting to Memgraph

DataBoyTX avatar Nov 06 '24 01:11 DataBoyTX