-
Notifications
You must be signed in to change notification settings - Fork 427
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
Custom attribute with both NUMBER and BOOL values #1214
Comments
I haven't tested it out, but looking at the source, will overriding class CustomAttribute(BooleanAttribute):
def get_value(self, value: Dict[str, Any]) -> Any:
if 'N' in value:
value = {'B': bool(value['N'])}
return super().get_value(value) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi,
How can I create a custom attribute that contains both number and BOOL values?
NUMBER may have been mixed up with past data in the same attribute in DynamoDB.
I would like to read all the numbers and BOOL values in DynamoDB and convert them to BOOL.
However, the
attr_type
must be specified, and it can only be either BOOL or number.I would appreciate it if you could tell me how to resolve this issue.
DynamoDB:
CustomAttribute:
PynamoDB/pynamodb/attributes.py
Line 194 in e8d3bb4
I see here that it may not be supported, but if there is another way, please let me know.
Thanks.
The text was updated successfully, but these errors were encountered: