PynamoDB
PynamoDB copied to clipboard
mypy error [arg-type]: set nullable attributes to None
Looks like, there is something missing in the type definition if null=True. Before 6.0.0 this was not an issue.
from pynamodb.models import Model
from pynamodb.attributes import UnicodeAttribute
class Models(Model):
class Meta:
table_name = "table"
hash_key = UnicodeAttribute(hash_key=True)
nullable_key = UnicodeAttribute(null=True)
model = Models(hash_key="foo", nullable_key="bar")
model.save()
model.update(actions=[Models.nullable_key.set(None)])
# error: Argument 1 to "set" of "Attribute" has incompatible type "None"; expected "str | Attribute[str] | _Increment | _Decrement | _IfNotExists | _ListAppend" [arg-type]