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

Dynamodb query missing validation #8474

Open
MartenMIK opened this issue Jan 8, 2025 · 0 comments
Open

Dynamodb query missing validation #8474

MartenMIK opened this issue Jan 8, 2025 · 0 comments

Comments

@MartenMIK
Copy link

My DynamoDB query causes an error in aws but not in moto, where it succeeds and returns results (running 5.0.26).

The error raised in aws is:
An error occurred (ValidationException) when calling the Query operation: Value provided in ExpressionAttributeNames unused in expressions: keys: {#visible}

The query:

query_params = {
            "TableName": self.table_name,
            "IndexName": "SchemaIndex",
            "KeyConditionExpression": "#schema = :schema and begins_with(#id, :env)",
            "ProjectionExpression": "#schema, #id, #sk",
            "ExpressionAttributeNames": {
                "#schema": "_schema",
                "#id": "_id",
                "#sk": "_sk",
                "#visible": "_visible",
            },
            "ExpressionAttributeValues": {
                ":env": {"S": env},
                ":schema": {"S": schema},
                ":visible_true": {"BOOL": True},
            },
            "Limit": limit,
        }

indexQuery = self.client.query(**query_params)

Note that #visible and :visible_true are not used in expressions.

With #7742 the same validation error has been added to dynamo db updates, but it is missing from queries. It could well be missing for other operations too, worth checking.

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

1 participant