Skip to content

feat: multi-attribute support for expression key builder - #3466

Open
drew-berra wants to merge 1 commit into
aws:mainfrom
drew-berra:feature/dynamodb-expression-multi-attribute-key-conditions
Open

feat: multi-attribute support for expression key builder#3466
drew-berra wants to merge 1 commit into
aws:mainfrom
drew-berra:feature/dynamodb-expression-multi-attribute-key-conditions

Conversation

@drew-berra

@drew-berra drew-berra commented Jul 1, 2026

Copy link
Copy Markdown

Problem: The key builder in the expression package only supported exactly two keys, PK + SK. Following the recently released multi-attribute key pattern for GSIs in DDB, a valid query can now support multiple key conditions (DynamoDB currently supports up to 4 partition key + 4 sort key attributes per GSI).

Solution: Update the KeyAnd portion of the expression builder to support multiple keys. Ensure that all but the last key being added are equality, and that the last key is not another KeyAnd expression. Leverage variadic function to maintain backwards compatibility with previous expression building.

Testing: make unit + unit test coverage for new behavior

Issue: None

Reference document: https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/GSI.DesignPattern.MultiAttributeKeys.html

PLEASE READ BEFORE CONTINUING

DO NOT submit pull requests that directly modify generated source files, e.g. /service/s3/api_client.go. Generated source files will always include an identifying header:

// Code generated by smithy-go-codegen DO NOT EDIT.

Manual changes to these files will be overwritten by code generation that occurs as part of the daily SDK release process.

DO NOT submit pull requests that directly modify files in the /codegen/sdk-codegen/aws-models folder. These are API model files, owned by each AWS service team, that are updated automatically as part of the daily SDK release process. Local changes to these files will not persist.

If you believe the contents of any of these files need to be changed, please open an issue.

If the PR addresses an existing bug or feature, please reference it here.

This PR adds in support for multi-attribute keys in the ddb expression builder. This is in support of a new DDB feature documented here.

To help speed up the process and reduce the time to merge please ensure that Allow edits by maintainers is checked before submitting your PR. This will allow the project maintainers to make minor adjustments or improvements to the submitted PR, allow us to reduce the roundtrip time for merging your request.

Changelog

Please DO NOT include a changelog entry in your pull request (you may see
what these look like in other PRs submitted directly by SDK team members). We
will take care of this for you.

Problem: The key builder in the expression package only supported
exactly two keys, PK + SK. Following the recently released
multi-attribute key pattern for GSIs in DDB, a valid query can now
support multiple key conditions (DynamoDB currently supports up
to 4 partition key + 4 sort key attributes per GSI).

Solution: Update the KeyAnd portion of the expression builder to support
multiple keys. Ensure that all but the last key being added are
equality, and that the last key is not another KeyAnd expression.
Leverage variadic function to maintain backwards compatibility with
previous expression building.

Testing: make unit + unit test coverage for new behavior

Issue: None

Reference document: https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/GSI.DesignPattern.MultiAttributeKeys.html
@drew-berra
drew-berra requested a review from a team July 1, 2026 21:48
@Madrigal

Madrigal commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Thanks for the contribution. We have some internal work scheduled for this, will wait for leadership decision and come back to you

@raduendv

raduendv commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

@Madrigal @drew-berra seems like a duplicate for #3292 with a slightly different approach

@drew-berra

Copy link
Copy Markdown
Author

@raduendv yes I missed that other PR initially. I took a different approach with my change compared to the PR you linked, but I'm happy with whatever path forward the team takes and looking forward to be able to use the key builder for multi attribute keys

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 this pull request may close these issues.

3 participants