gqlalchemy
gqlalchemy copied to clipboard
[BUG] If a node attribute value contains an apostrophe, nx_translator().to_cypher_queries(G) breaks because the string values are contained in a single quote instead of double.
Memgraph version Which version did you use? 1.6.0
Environment Some information about the environment you are using Memgraph on: operating system, how do you connect, with or without docker, which driver etc.
Operating System: Darwin OS Version: Darwin Kernel Version 23.6.0: Mon Jul 29 21:14:30 PDT 2024; root:xnu-10063.141.2~1/RELEASE_ARM64_T6000 OS Release: 23.6.0 OS Architecture: arm64 Full Platform Info: macOS-14.6.1-arm64-arm-64bit
Connecting with docker. Not sure about which driver
Describe the bug A clear and concise description of what the bug is. When a string attribute value on a node contains an apostrophe, the nx_translator().to_cypher_queries(G) will break. It seems to be because string values are enclosed by a single quote instead of double quotes.
To Reproduce Steps to reproduce the behavior:
- Run the following python code
import networkx as nx
from gqlalchemy import Memgraph
from gqlalchemy.transformations.translators.nx_translator import NxTranslator
from warnings import filterwarnings
filterwarnings("ignore")
memgraph = Memgraph("127.0.0.1", 7687)
memgraph.drop_database()
graph = nx.Graph()
graph.add_nodes_from([(1, {"labels": "First", "name": "Josh's Laptop"}), 2, 3])
graph.add_edges_from([(1, 2, {"type": "EDGE_TYPE"}), (1, 3)])
nx_translator = NxTranslator()
for query in nx_translator.to_cypher_queries(graph):
memgraph.execute(query)
Expected behavior A clear and concise description of what you expected to happen.
I would expect that the queries should be seemlessly created and executed.