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

Query fails with more than 10 attributes in a query filter condition. #751

Closed
ezmuller opened this issue Feb 10, 2020 · 1 comment
Closed

Comments

@ezmuller
Copy link
Contributor

Observed with range_key_placeholder == #1 this substring check failed because the condition included more than 10 placeholders. Since '#1' is a substring of '#10' this expression evaluates to True: (range_key_placeholder and range_key_placeholder in filter_expression) in pynamodb.connection.base.Connection.query ->

if filter_condition is not None:
    filter_expression = filter_condition.serialize(name_placeholders, expression_attribute_values)
    # FilterExpression does not allow key attributes. Check for hash and range key name placeholders
    hash_key_placeholder = name_placeholders.get(hash_keyname)
    range_key_placeholder = range_keyname and name_placeholders.get(range_keyname)
    if (
        hash_key_placeholder in filter_expression or
        (range_key_placeholder and range_key_placeholder in filter_expression)
    ):
        raise ValueError("'filter_condition' cannot contain key attributes")
ezmuller pushed a commit to ermul/PynamoDB that referenced this issue Feb 10, 2020
ezmuller pushed a commit to ermul/PynamoDB that referenced this issue Apr 9, 2020
@jpinner-lyft
Copy link
Contributor

"fixed" in #800 by removing condition demotion entirely

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