gqlalchemy icon indicating copy to clipboard operation
gqlalchemy copied to clipboard

[BUG] to_cypher_value badly converts numpy objects

Open BorisTasevski opened this issue 2 years ago • 1 comments

GQLAlchemy version 1.3.2

Describe the bug When converting NetworkX graph to cypher queries, if the graph is populated with numpy objects the utility method to_cypher_value makes wrong conversions for numpy objects(arrays)

Expected behavior numpy array gets converted as array

Steps to reproduce

graph = nx.Graph()
graph.add_nodes_from([
    (1, {"Key": np.array(["Value1", "Value2"], dtype=object)}),
]
)

cypher = nx_to_cypher(graph)

print (list(cypher)[0])

Expected result CREATE ( {Key: ['Value1', 'Value2'], id: 1});

Actual result CREATE ( {Key: '['Value1' 'Value2']', id: 1});

BorisTasevski avatar Oct 19 '22 12:10 BorisTasevski

@BorisTasevski Please add steps to reproduce.

katarinasupe avatar Oct 19 '22 15:10 katarinasupe

Solved with

https://github.com/memgraph/gqlalchemy/pull/208

BorisTasevski avatar Dec 02 '22 09:12 BorisTasevski