-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
Cannot use key attribute in one DynamoDB index as non-key attribute in another index #4398
Labels
@aws-cdk/aws-dynamodb
Related to Amazon DynamoDB
bug
This issue is a bug.
needs-reproduction
This issue needs reproduction.
p1
Comments
speller26
added
bug
This issue is a bug.
needs-triage
This issue or PR still needs to be triaged.
labels
Oct 7, 2019
NGL321
added
@aws-cdk/aws-dynamodb
Related to Amazon DynamoDB
needs-reproduction
This issue needs reproduction.
language/python
Related to Python bindings
and removed
needs-triage
This issue or PR still needs to be triaged.
labels
Oct 7, 2019
I'm hitting the same issue in Java |
I have a workaround for Java (Kotlin, actually...), in case it's helpful to others:
|
I'm also hitting this bug using Typescript. |
I'm facing this issue as well. Thankfully, @perihelion1's work-around helps me for now. |
RomainMuller
added a commit
that referenced
this issue
Mar 30, 2020
Removes the restriction that a key attribute cannot be used as a non-key attribute in a distinct secondary index. This was excessively restricting what can be done, as new integration tests demonstrated that there is no problem in deploying such a configuration. Fixes #4398
mergify bot
pushed a commit
that referenced
this issue
Apr 1, 2020
…er (#7075) Removes the restriction that a key attribute cannot be used as a non-key attribute in a distinct secondary index. This was excessively restricting what can be done, as new integration tests demonstrated that there is no problem in deploying such a configuration. Also, switches from `Array`s to `Set`s to represent the sets of names that must be unique. Fixes #4398
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
@aws-cdk/aws-dynamodb
Related to Amazon DynamoDB
bug
This issue is a bug.
needs-reproduction
This issue needs reproduction.
p1
I'm using the CDK (in Python) to create global secondary indexes in my DynamoDB table, and one secondary index has a key that's used as a non-key attribute in another index. I have no problems doing this manually in the DynamoDB console, but when I use CDK, I get an error because CDK seems to check the union of key attributes across all indexes against the union of non-key attributes across all indexes. I traced the problem to this commit, specifically these lines:
Was this behavior intentional? This seems to restrict what one can do with CDK vs DynamoDB directly.
Reproduction Steps
In the following snippet,
bar
is used as a non-key attribute in Index1 and as a key attribute in Index2.Error Log
Error: a key attribute, bar, is part of a list of non-key attributes, bar,blah, which is not allowed since all key attributes are added automatically and this configuration causes stack creation failure
Environment
Other
This could probably be fixed by changing the
addGlobalSecondaryIndex
method inTable
so the key and non-key attributes are only compared per index.This is 🐛 Bug Report
The text was updated successfully, but these errors were encountered: