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

BUG: #443 broke batch.delete_objects() with "AND" operand at the root #477

Closed
glesperance opened this issue Sep 4, 2023 · 1 comment
Closed
Assignees

Comments

@glesperance
Copy link

glesperance commented Sep 4, 2023

PR #443 broke batch.delete_objects() with an "AND" operand at the root.

We can no longer run queries of the form:

with client.batch.configure() as batch:
    batch.delete_objects(
            class_name="Page",
            where={
                "operator": "And",
                "operands": [
                    {"path": ["nonce"], "operator": "NotEqual", "valueText": "XH0RZ7W2"},
                    {
                        "path": ["author", "Author", "id"],
                        "operator": "Equal",
                        "valueText": "765aba1b-ba5b-53db-a255-e236f4a54397",
                    },
                ],
            },
            tenant='exq596omhak4osks59w9df3v',
        )

changing

         payload = {
            "match": {
                "class": _capitalize_first_letter(class_name),
-               "where": _clean_delete_objects_where(where),
+               "where": where,
            },
            "output": output,
            "dryRun": dry_run,
        }

in crud_batch.py fixes the issue.

This is the error

ValueError: 'value' field is either missing or incorrect: {'operator': 'And', 'operands': [{'path': ['nonce'], 'operator': 'NotEqual', 'valueText': 'XH0RZ7W2'}, {'path': ['author', 'Author', 'id'], 'operator': 'Equal', 'valueText': '765aba1b-ba5b-53db-a255-e236f4a54397'}]}. Valid values are: {'valueStringArray', 'valueIntArray', 'valueTextArray', 'valueString', 'valueNumber', 'valueText', 'valueDate', 'valueGeoRange', 'valueBoolean', 'valueInt', 'valueNumberArray', 'valueBooleanArray'}.
@glesperance
Copy link
Author

Fixed by #479 -- (will be released through the next minor patch)

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

No branches or pull requests

2 participants