Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] NxTranslator.to_cypher_queries doesn't escape apostrophes. #249

Open
jackabouaad opened this issue May 25, 2023 · 1 comment
Open
Assignees
Labels
bug bug community community Effort - Low Effort - Low Frequency - EveryTime Frequency - EveryTime Priority - Next Priority - Next Reach - VeryFew Reach - VeryFew Severity - S3 Severity - S3

Comments

@jackabouaad
Copy link

Memgraph version
Memgraph 2.8.0
Gqlalchemy 1.4.1

Environment
I am running Memgraph in Docker on a MacBook Pro Apple M1 Max chipset.

Bug description, reproduction and expected behaviour
The method translator.to_cypher_queries [1] is not escaping apostrophes.
Node in NetworkX graph: (15981, { 'labels': 'Word', 'Token': "Ain't", 'IPA': 'ʔ aɪ n t' })
Generated query using the aforementioned method: CREATE (:Word {Token: 'Ain't', IPA: 'ʔ aɪ n t', id: 15981}); [2]
When trying to execute the query [2] in Memgraph, I get the following: Query failed: Invalid query. Which is expected because the apostrophe wasn't escaped.
The method [1] should instead return the query as follows: CREATE (:Word {Token: 'Ain\'t', IPA: 'ʔ aɪ n t', id: 15981});

Potential solution
Simple solution for the time being: escape_apostrophes = lambda x: re.compile(r"(['])").sub(r"\\'", x)

@katarinasupe katarinasupe added the type: bug Something isn't working label May 25, 2023
@katarinasupe katarinasupe added this to the v1.5.0 milestone May 25, 2023
@katarinasupe katarinasupe moved this to Todo in gqlalchemy May 25, 2023
@katarinasupe
Copy link
Contributor

Thank you @jackabouaad for reporting this here too :) We will include it in the next release. If you're up for the open source contribution, our PRs are always open :D

@katarinasupe katarinasupe removed this from the v1.5.0 milestone Sep 15, 2023
@katarinasupe katarinasupe added bug bug Importance - I3 Importance - I3 Severity - S3 Severity - S3 Effort - Low Effort - Low community community and removed type: bug Something isn't working labels Dec 28, 2023
@hal-eisen-MG hal-eisen-MG added Priority - Later Priority - Later and removed Priority - Later Priority - Later labels Feb 4, 2024
@hal-eisen-MG hal-eisen-MG added Priority - Later Priority - Later and removed Priority - Later Priority - Later labels Feb 18, 2024
@katarinasupe katarinasupe added Frequency - EveryTime Frequency - EveryTime Reach - VeryFew Reach - VeryFew and removed Importance - I3 Importance - I3 labels Feb 27, 2024
@hal-eisen-MG hal-eisen-MG added Priority - Next Priority - Next and removed Priority - Later Priority - Later labels Apr 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug bug community community Effort - Low Effort - Low Frequency - EveryTime Frequency - EveryTime Priority - Next Priority - Next Reach - VeryFew Reach - VeryFew Severity - S3 Severity - S3
Projects
Status: Todo
Development

No branches or pull requests

5 participants