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

Using backticks in all queries to enhance compatibility for spaces and special characters #292

Open
jurrian opened this issue Jan 2, 2018 · 6 comments

Comments

@jurrian
Copy link

jurrian commented Jan 2, 2018

I'd like to propose that backticks are used in all queries, in order to make all neomodel queries compatible with spaces and special characters. Some queries already use backticks by default.
Using backticks has been discussed before in #156 and #188.

However, in #156 the following was mentioned by @robinedwards:

The thing is they do break when they are mapped to python identifiers such as properties (RelManagers)

I have tried, but couldn't find any problems that might arise.
This proposal would help compatibility in general and shouldn't break anything.

@jurrian jurrian changed the title Using backticks in all queries to enhance compatibility Using backticks in all queries to enhance compatibility for spaces and special characters Jan 2, 2018
@aanastasiou
Copy link
Collaborator

@jurrian Can you please clarify if that is backticks in the way they used to be interpreted in Python 2 (?). Backtick is this character ( ` ) right?

@jurrian
Copy link
Author

jurrian commented Mar 5, 2019

The backtick is indeed the character ( ` ). Strings containing these backticks are treated literal so a query containing the string 'http://example.com#' would err, while `http://example.com#` (note the backticks) would work. So I am not talking about backticks as used in Python 2 but as literal designators.

If I remember correctly, neomodels already uses backticks in some queries but not all causing less compatibility (i.e. for urls)

@aanastasiou
Copy link
Collaborator

@jurrian Alright, I am still somewhat confused (sorry). Backticks within string literals are treated as part of the string. How does this help? Is it possible to provide a simple print based example?

@aanastasiou
Copy link
Collaborator

@jurrian Any update about this?

@jurrian
Copy link
Author

jurrian commented Mar 31, 2019

Say I want to produce a Cypher query like this:

MATCH (n)-[`http://schema.org/knows`]-(m)
RETURN n

This is valid Cypher. Note the backticks around the URL.
Last time I checked, when I created this issue, doing something like that was not possible in Neomodels.
As specified in the issues mentioned before, backticking all queries on all appropriate places would make Neomodels more compatible for spaces and special characters.

In fact, a lot of queries that Neomodels produces already contain backticks, but not everywhere. Therefore I suggest to use backticks in all places in the query. Refering back to my first post, I haven't found any problems that might arise using backticks everywhere (of course everywhere where Cypher language allows).

Hope this answers your question.

@aanastasiou
Copy link
Collaborator

@jurrian Yes it does, thank you very much for clarifying.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants