Escaping apostrophes/ticks in translator.to_cypher_queries method with GQLAlchemy

TenTonBonton

I have an issue in my code Python code. I'm using GQLAlchemy and Memgraph 2.7

The function cypherQueryCreator.createCypherQuery in my program doesn't appear to be handling apostrophes (ticks) correctly. I have a node in a NetworkX graph that looks kind fo like this:

netNode = (15981, { 'category': 'Lexeme', 'Term': "Can't", 'Phonetics': 'k æ n t' })

When I watn to generate a cypher query, the output that I get is CREATE (:Lexeme {Term: 'Can't', Phonetics: 'k æ n t', id: 15981}); and it is not a wonder that it doesn't work since \ is missing in front of '. I was hoping to get this code CREATE (:Lexeme {Term: 'Can\'t', Phonetics: 'k æ n t', id: 15981});

Do you have any tips for me?

Taja Jan

This is a known bug, and there is a workaround solution offert in GitHub issue. The code that should help you is escape_apostrophes = lambda x: re.compile(r"(['])").sub(r"\\'", x)

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Method Illuminate\Translation\Translator::getFromJson does not exist

save escaping method reference in swift

Escaping ':' and '?' in parameterized SQL queries in Rails

In Javascript, how to avoid the "escaping" in createTextElement method?

Disable escaping characters in redirect_to method

Error - RSpec - expect method is escaping '\n'

What is GQLAlchemy and which graph databases does it support?

Does GQLAlchemy support migrations equivalent to DjangoORM or Alembic?

Supported datatypes for indexes when using GQLAlchemy and Memgrpah

How to serialize GQLAlchemy model objects to JSON?

Can GQLAlchemy be used to validate the scheme of the dataset?

Proper escaping of LIKE queries with Doctrine querybuilder

Knex not properly escaping raw postgres queries

prevent python from escaping quotes in sql queries

Kotlin Back-Tick escaping in method names: How does it work?

Powershell, escaping specific character in string variable not present in regex escape method

Can I specify the labels in subclasses when using GQLAlchemy and Memgraph?

When creating a Kafka stream with GQLAlchemy which arguments are required?

Python/MySQL: Escaping strings used as parameters in raw database queries

Spring Boot + Cucumber test: cucumber cannot detect my step definition method due to double quotation escaping in JSON

Node-MySQL - Escaping in Query() Method vs Mysql.Escape() / Mysql.EscapeId()

How can I stop Spring JPA from escaping the arguments to a query method?

Different results with Microsoft Translator API / Web Translator

Getting rid of / escaping unwanted symbols before adding statements through Cypher in Neo4J

How do you define direction of relationship using GQLAlchemy and can it be undirected/bidirectional?

Escaping & in a URL

Understanding Escaping

Escaping @ in Blazor

Escaping ; () in echo