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

String max length #167

Open
samwho opened this issue Dec 19, 2013 · 2 comments
Open

String max length #167

samwho opened this issue Dec 19, 2013 · 2 comments

Comments

@samwho
Copy link

samwho commented Dec 19, 2013

When you call write_attribute here: https://github.com/Veraticus/Dynamoid/blob/master/lib/dynamoid/fields.rb#L73

You're checking the length of the string with size when it should actually be bytesize. Also, the length of things aren't constrained unless they're a primary or range key.

Relevant documentation:

@ngordon17
Copy link

.size and .bytesize on a string are the same thing since a character is a byte and .size returns the number of characters.

Also, the size limit applies to the object as a whole. In fact you cannot store items greater than 400KB (so the limit should be raised to 400KB from 64KB which is the old limit). This check is somewhat pointless though since it doesn't check total item size, but is still somewhat useful as a sanity check.

@samwho
Copy link
Author

samwho commented Mar 20, 2015

The strings in DynamoDB are UTF-8 (it says in one of the links I put in the original post), which doesn't guarantee that one character is one byte in length. For more information, this is an excellent read: http://www.joelonsoftware.com/articles/Unicode.html.

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

2 participants