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
it seems that the missing parameter gets used on reading despite the documentation stating this:
NOTE: Marshmallow uses the missing keyword during deserialization, which occurs when we save
Or do I use it the wrong way? I want to test some behaviour of our application in cases where a new field was added to a model about how old entries behave.
First, I define the old structure and add the table:
class ReducedTestModel(DynaModel):
class Table:
name = "test-model"
hash_key = "name"
read = 25
write = 5
if dynamoDBHost():
resource_kwargs = {"endpoint_url": dynamoDBHost()}
class Schema:
name = fields.String()
foo = fields.String(missing=lambda: "afoo")
ReducedTestModel.Table.create_table()
Now, I define a new model being the same as the old one except one added field:
class FullTestModel(DynaModel):
class Table:
name = "test-model"
hash_key = "name"
read = 25
write = 5
if dynamoDBHost():
resource_kwargs = {"endpoint_url": dynamoDBHost()}
class Schema:
name = fields.String()
foo = fields.String(missing=lambda: "afoo")
bar = fields.String(missing=lambda: "abar")
Read the stored "old" entity from the new model and print the new attribute:
Hi,
it seems that the
missing
parameter gets used on reading despite the documentation stating this:Or do I use it the wrong way? I want to test some behaviour of our application in cases where a new field was added to a model about how old entries behave.
First, I define the old structure and add the table:
Then an entry gets stored:
Now, I define a new model being the same as the old one except one added field:
Read the stored "old" entity from the new model and print the new attribute:
The output is "abar", so it used the missing attribute. But why? Expectation was actually a crash due to a missing attribute.
The text was updated successfully, but these errors were encountered: