-
Notifications
You must be signed in to change notification settings - Fork 417
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
How to handle the param if there're single quotes in it? #1722
Comments
@noahxzhu Did you try using the backslash for the cypher query? Your example above doesn't show it.
|
@noahxzhu Additionally, this sounds more like a question than a bug. |
Can you put double quotes around the string? SELECT * from ag_catalog.cypher('graph_store', $$
MERGE (n1:`Entity` {id: 'I'})
MERGE (n2:`Entity` {id: "It's better for technology companies to be run by product people"})
MERGE (n1)-[:`Learned`]->(n2)
$$) as (a ag_catalog.agtype); This worked for me alright |
@markgomer |
@jrgemignani |
Try setting the search_path: SET search_path TO ag_catalog; I'm not sure why it is not working without this, though. |
After setting the search_path, now it's working, but why? |
Another question, should this work as it in Neo4j?
|
The search path is needed to see Cypher |
I'm not sure I understand what you are asking. Also, keep in mind that you will likely need to backslash all non wrapping quote characters. |
I mean, that query works in Neo4j, but I tried it in pg, it doesn't work. Can a label include quotes?
|
The behavior in the python driver NOT WORK
WORK
NOT WORK
NOT WORK
|
I tested this on AGE-viewer and it seems to be working... what is the error message you're getting? |
@markgomer Thank you for your reply |
I had the same error showing up, but I worked around it by creating labels separately: SELECT create_vlabel('graph_store', 'TEST');
SELECT create_elabel('graph_store', 'ABC_IS\'a'); Please check if this works for you |
I did some tests with the python driver, the behavior likes below Case 1
GOT
Case 2
GOT
Case 3I think we shouldn't add quotes for the params in the query template, right?
GOT
Case 4
GOT
Case 5
GOT Succeed but the data like this
Case 6
GOT
|
It appears that the upsert_triplet_test function's object parameter contains a single quotation, which is causing the error. 'Technology busin be run by product people' is one of the syntactic errors that the warning particularly addresses. This is probably because the Cypher query contains a syntax mistake because the single quote in the string is being read as the end of the string. To handle this case, you can escape the single quote within the object parameter. In Python, you can escape a single quote by using another single quote. Here's how you can modify your function call to handle the single quote in the object parameter: upsert_triplet_test(
"I", "Learned", "It''s better for technology companies to be run by product people"
) By replacing the single quote with two single quotes (''), you escape the single quote within the string, ensuring that it is interpreted correctly in the Cypher query. Your modified Cypher query should look like this: SELECT * FROM ag_catalog.cypher('graph_store', $$
MERGE (n1:`Entity` {id: 'I'})
MERGE (n2:`Entity` {id: 'It''s better for technology companies to be run by product people'})
MERGE (n1)-[:`Learned`]->(n2)
$$) AS (a ag_catalog.agtype); |
Hi @mannas006
|
Hello @noahxzhu |
This issue is stale because it has been open 60 days with no activity. Remove "Abondoned" label or comment or this will be closed in 14 days. |
This issue was closed because it has been stalled for further 14 days with no activity. |
I'm posting to report that I'm experiencing this bug as well. I do not think that this is a question, as this bug only occurs while using the apache-age python driver. Nested quotation marks work fine when querying directly in psql. If I find a workaround I will report to this thread |
Describe the bug
An error is observed when a property parameter includes a single quote.
How are you accessing AGE (Command line, driver, etc.)?
What data setup do we need to do?
This is the error
What is the necessary configuration info needed?
What is the command that caused the error?
Not sure how to handle this case
Expected behavior
This merge operation should be succeed.
Environment (please complete the following information):
Additional context
no
The text was updated successfully, but these errors were encountered: