Skip to content

broken build_filter_conditions for keys with spaces // backtick escaping missing? #295

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

Closed
Robert-O-Hoffmann opened this issue Nov 10, 2023 · 2 comments · Fixed by #296
Closed

Comments

@Robert-O-Hoffmann
Copy link

Robert-O-Hoffmann commented Nov 10, 2023

I recently ran into a crash (while my code did not change) when using collection.find() to check whether the following dict data already exists:
{'article': 'bottle-white', 'amount': 50000, 'order by date': '2023-09-20', 'delivery date': '2023-10-20', 'type': 'bottle capacity'}

I traced it down to utils.py / build_filter_conditions, which is

conditions = [f"doc.{k} == {json.dumps(v)}" for k, v in filters.items()]

but should be

conditions = [f"doc.`{k}` == {json.dumps(v)}" for k, v in filters.items()]

to allow keys with spaces, as possible in ArangoDB.

I would have bet that it worked on a previous version of python-arango, but the git seems to say otherwise.

Thanks for considering a fix.

Edit: I appears version 7.6.0 was the last one working: It does not have the build_filter_conditions function but relies on an other method that transmits the json data directly to a url, instead of composing an AQL query that now breaks.

@aMahanna
Copy link
Member

Hey @Robert-O-Hoffmann thanks for pointing this out, will get back to you when #296 is merged & released

@aMahanna
Copy link
Member

7.8.1 released, thank you again for catching this!

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

Successfully merging a pull request may close this issue.

2 participants