Skip to content

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

Closed
@Robert-O-Hoffmann

Description

@Robert-O-Hoffmann

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions