-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Empty attribute values cannot be added to a DynamoDB table #1189
Comments
How did they fix this in Javascript? This is a service side limitation, attribute values cannot be created with an empty string value (not sure the exact reasoning for this). What is the expected behavior in the SDK? |
Discussion at aws/aws-sdk-js#833 |
Ah I see, I am not crazy about the idea of adding a flag to ignore empty strings and treat them as null. We did something similar for the DDB mapper and it's surprising, possibly dangerous behavior since null and empty string do not have the same semantics and we are subtly hiding a service side limitation. That said an opt in approach seems reasonable. I've reached out to the service team to see if it's possible to relax the constraint on empty string as I think that would be the best solution, I'll let you know what I hear and we can go from there. |
+1 |
I've heard back from the DynamoDB team. They plan on supporting empty string sometime in 2018, no specific dates at the moment though. I'll update this issue if I get more information. |
Hello @shorea, Any update on when this would be supported? |
@shorea Any update on this? What I experienced is that if I have optional values on my request payload, DynamoDB populates a digit into the values on retrieval. This lead to the inability to retrieve all the values from DynamoDB on my GET requests due to parsing errors originating from the values DynamoDB was populating the optional fields with. So I resolved to provide a default value whenever a field value is not supplied when saving data to DynamoDB. However, a solution to enable storing of empty strings, especially when the field is optional will be awesome. |
Any update on this? |
I find it unacceptable that a database like this doesn't support empty strings or native floats, (you have to convert them to Decimal). |
any update? |
We just started with DynamoDB and there you go, SURPRISE! I agree that empty doesn't make great sense in NoSQL but it would really help customers and would love to know if this has come to any fix after a year and a half wait time. |
any update? still waiting :( |
This should be a quick and easy thing to fix on the DynamoDB side. Where are the AWS pros at!? This makes it so that you can not have any optional fields... any work arounds or answers? |
I have still not found a solution. Just another entry into my "Why I never want to use AWS" list.
It is far from perfect but it works. |
DynamoDB does not accept objects with an empty string in its attribute. See, e.g., aws/aws-sdk-java#1189
@VladMasarik Yeah still waiting
Still a crappy work around as in the front end I need to find if null and then equate it to "" to make my tables work correctly |
I used an option when initialising the document client. Works as expected except for null displaying as true. This is, however, expected behaviour in dynamodb. Here is the example from my javascript code: const documentClient = new AWS.DynamoDB.DocumentClient({convertEmptyValues: true}); |
Same here. const documentClient = new AWS.DynamoDB.DocumentClient({convertEmptyValues: true}) works for me. |
It is already 2020 and I cannot believe aws still does not support empty string. Is this function in the plan or you guys just don't care? Please give us an answer here. Thank you. |
I've reached out to the DynamoDB organization again regarding this issue. DynamoDB is aware of the requirement and is still considering a fix for the issue. We know this response isn’t particularly satisfying, since the issue has been open for such a long time. |
i can believe after all these years this db can't support empty strings. |
My Solution
|
DynamoDb now supports empty string values for non-key attributes: https://aws.amazon.com/about-aws/whats-new/2020/05/amazon-dynamodb-now-supports-empty-values-for-non-key-string-and-binary-attributes-in-dynamodb-tables/ |
use update list to update the empty array |
Adding the following document to a DynamoDB table:
gives the following error:
This is a common use case and already fixed for https://github.com/aws/aws-sdk-js/pull/1283#issuecomment-306954767[JavaScript SDK]. It has caused enough frustration among customers. This is evident at https://forums.aws.amazon.com/thread.jspa?threadID=90137&start=0&tstart=0 and https://news.ycombinator.com/item?id=13170746 and should be fixed.
The text was updated successfully, but these errors were encountered: