Open monkut opened 5 years ago
Indeed, there's something wrong with our handling of DynamoDB NULL
type.
when I have attr = NumberAttribute(null=True)
or without null=True, if the value is null (None), I get this same error... inspecting the code I see that in deserialize it's doing json.loads(value), which throws said error if value=None
Any update?
To help me understand the issue here, are these items (containing {"NULL": true}
attributes) written via some other client than pynamodb? pynamodb omits storing attributes altogether when the value is null, which is why this usually works fine.
@garrettheel I just came across this problem as well. Yes, in our case, the offending items were added using boto3 directly, including some NULL fields. Now we are moving to PynamoDB, but looking up older pre-Pynamo items is causing this stack trace.
I think PynamoDB ought to be able to handle this -- even if it requires a special setting or something. In the meantime, is there any workaround you can suggest? Even a monkey patch?
@cjh79 can you try this against pynamodb==5.0.0b1
? I believe it should address this
@garrettheel thank you, yes, that version fixes it. Would you recommend against putting 5.0.0b1 into production? I've read the release notes, and none of the breaking changes should affect us, but how stable is this release?
@cjh79 it hasn't been widely tested yet, so you may want to wait until the stable release if you're risk averse. that said, there are no changes in this release that I see as particularly risky - the major version bump was mostly due to the Python 3+ requirement
@garrettheel is there any timeline on getting 5.0.0 out of beta?
I have the following model:
And it appears that when performing a query for a result where the
errors
value is Null, the query fails to properly decode the item with the exception:Query:
DynamoDB Record:
Why is deserialization failing for the
errors
field?With
JSONAttribute(null=True)
shouldn't it be able to handle null values for theerrors
field?