You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The "breaking changes" list of v6.0.0 is missing a breaking change.
With PynamoDB v5.3.2 (and before) an equal check (==) on an attribute did an is check.
With PynamoDB v6.0.0 it returns a Comparison operator (which then fails in boolean context).
This change of behaviour was introduced in commit 163c75f for issue #508.
Sample code:
frompynamodb.modelsimportModelfrompynamodb.attributesimportUnicodeAttributeclassUserModel(Model):
""" A DynamoDB User """classMeta:
table_name='dynamodb-user'region='us-west-1'email=UnicodeAttribute(hash_key=True)
first_name=UnicodeAttribute()
last_name=UnicodeAttribute()
field=UserModel.emailiffield==UserModel.email:
print("Email field")
else:
print("Not the email field")
Running with PynamoDB v5.3.2:
Email field
Running with PynamoDB v6.0.0
Traceback (most recent call last):
File ".....py", line 18, in <module>
if field == UserModel.email:
File ".../site-packages/pynamodb/expressions/condition.py", line 58, in __bool__
raise TypeError("unsupported operand type(s) for bool: {}".format(self.__class__.__name__))
TypeError: unsupported operand type(s) for bool: Comparison
The fix for the sample code:
iffield==UserModel.email:
should be replaced with:
iffieldisUserModel.email:
The text was updated successfully, but these errors were encountered:
The "breaking changes" list of v6.0.0 is missing a breaking change.
With PynamoDB v5.3.2 (and before) an equal check (
==
) on an attribute did anis
check.With PynamoDB v6.0.0 it returns a Comparison operator (which then fails in boolean context).
This change of behaviour was introduced in commit 163c75f for issue #508.
Sample code:
Running with PynamoDB v5.3.2:
Running with PynamoDB v6.0.0
The fix for the sample code:
should be replaced with:
The text was updated successfully, but these errors were encountered: