-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Bug fix: Dynamodb update_table missing table entries in output #11938
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 fix: Dynamodb update_table missing table entries in output #11938
Conversation
…e schema after update
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Welcome to LocalStack! Thanks for raising your first Pull Request and landing in your contributions. Our team will reach out with any reviews or feedbacks that we have shortly. We recommend joining our Slack Community and share your PR on the #community channel to share your contributions with us. Please make sure you are following our contributing guidelines and our Code of Conduct.
All contributors have signed the CLA ✍️ ✅ |
I have read the CLA Document and I hereby sign the CLA |
I do not have the permission to add labels to the PR. Please add a |
Thank you for contributing @IreneLime. Could you please add some tests? |
Hi @viren-nadkarni, I have added an aws service test on dynamodb for this case. To run the test: Without the fix: Test will fail because "SSESpecification" does not exist in returned table content. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job adding the test! Just one hiccup:
…o parity test and verify the behaviour
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Congrats on your first contribution to LocalStack!
Motivation
This PR resolves the issue: #11781
Description of issue: The output from the UpdateTable command does not include the SSEDescription for a table which was created with it.
Previous Behaviour
As described by the previous comment on line 781 of localstack-core\localstack\services\dynamodb\provider.py, DynamoDBLocal cannot change certain table parameters, including SSEDescription and replica.
As a result, the return value of update_table is a table returned by DynamoDBLocal, which does not contain these parameters.
Changes
After DynamoDBLocal makes changes to the table, use get_table_schema to retrieve the entire schema definition of the table, which includes the original and changed parameters.
Change return value such that the update_table function returns the schema obtained.
Testing
Create a dynamodb table:
awslocal dynamodb create-table --table-name Example --attribute-definitions AttributeName=key,AttributeType=S --key-schema AttributeName=key,KeyType=HASH --provisioned-throughput ReadCapacityUnits=5,WriteCapacityUnits=5 --sse-specification Enabled=true,SSEType=KMS,KMSMasterKeyId=some-kms
Update the dynamodb table:
awslocal dynamodb update-table --table-name Example --billing-mode PAY_PER_REQUEST
Original code will not return the original SSEDescription. New changes will include both SSEDescription and the changed "Billing Mode" parameters.