Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mypy error [arg-type]: set nullable attributes to None #1217

Open
Wurstnase opened this issue Jan 15, 2024 · 0 comments
Open

mypy error [arg-type]: set nullable attributes to None #1217

Wurstnase opened this issue Jan 15, 2024 · 0 comments

Comments

@Wurstnase
Copy link
Contributor

Wurstnase commented Jan 15, 2024

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]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant