From 5e4522e0bc26a388e298e2da22ec1cfcdafe51c2 Mon Sep 17 00:00:00 2001 From: Nico Tonnhofer Date: Mon, 15 Jan 2024 13:06:13 +0100 Subject: [PATCH] Fix documentation for MapAttribute default must be immutable https://pynamodb.readthedocs.io/en/latest/api.html\#pynamodb.attributes.Attribute --- pynamodb/attributes.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pynamodb/attributes.py b/pynamodb/attributes.py index ce750bf4..964b5ae6 100644 --- a/pynamodb/attributes.py +++ b/pynamodb/attributes.py @@ -929,7 +929,7 @@ class MapAttribute(Attribute[Mapping[_KT, _VT]], AttributeContainer, metaclass=M For example, below we define "MyModel" which contains a MapAttribute "my_map": class MyModel(Model): - my_map = MapAttribute(attr_name="dynamo_name", default={}) + my_map = MapAttribute(attr_name="dynamo_name", default=dict) When instantiated in this manner (as a class attribute of an AttributeContainer class), the MapAttribute class acts as an instance of the Attribute class. The instance stores data about the attribute (in this