You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
to_json doen't project null fields. In this case, to_json() have important differences with the model.
class Holding(MapAttribute):
id_holding= NumberAttribute()
available = NumberAttribute(null=True)
class HoldingModel(Model):
id_number = NumberAttribute(hash_key=True)
holdings = ListAttribute(of=Holding)
# doesnt work
for object in HoldingModel.query(1):
object.to_json()["holdings"][0]['available']
# work
for object in HoldingModel.query(1):
object..holdings[0].available
As available doesn't exist in dynamodb (because null fields aren't saved), it doesn't exist in my model.
if the available have default=None, in the json the available doesn't exist, if the default is 0, in the json the available exist
The text was updated successfully, but these errors were encountered:
to_json doen't project null fields. In this case, to_json() have important differences with the model.
As available doesn't exist in dynamodb (because null fields aren't saved), it doesn't exist in my model.
if the available have default=None, in the json the available doesn't exist, if the default is 0, in the json the available exist
The text was updated successfully, but these errors were encountered: