-
-
Save betamoo/1fb15692d6fa74b9ddacfd4965632b26 to your computer and use it in GitHub Desktop.
PynamoDB model.update_item bug in LBA
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pynamodb.models import Model | |
from pynamodb.attributes import ( | |
UnicodeAttribute, LegacyBooleanAttribute, BooleanAttribute) | |
class UserModel(Model): | |
class Meta: | |
host = "http://localhost:8000" | |
table_name = "UserModel2" | |
id = UnicodeAttribute(hash_key=True) | |
foo = BooleanAttribute() | |
bar = UnicodeAttribute(null=True) | |
class UserModel2(Model): | |
class Meta: | |
host = "http://localhost:8000" | |
table_name = "UserModel2" | |
id = UnicodeAttribute(hash_key=True) | |
foo = LegacyBooleanAttribute() | |
bar = UnicodeAttribute(null=True) | |
if UserModel.exists(): | |
UserModel.delete_table() | |
UserModel.create_table(read_capacity_units=2, write_capacity_units=2) | |
u1 = UserModel(id="item1", foo=True, bar="item1") | |
u1.save() | |
u1 = UserModel2.get('item1') | |
#json error TypeError: expected string or buffer (value written by BA isn't readable by LBA) | |
u1.update_item('bar', "item1_update", 'PUT') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment