Skip to content

Instantly share code, notes, and snippets.

@betamoo

betamoo/run.py Secret

Last active February 28, 2018 00:11
Show Gist options
  • Save betamoo/1fb15692d6fa74b9ddacfd4965632b26 to your computer and use it in GitHub Desktop.
Save betamoo/1fb15692d6fa74b9ddacfd4965632b26 to your computer and use it in GitHub Desktop.
PynamoDB model.update_item bug in LBA
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