-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Description
Describe the feature
Currently printing/logging a FilterExpression will show something like:
<boto3.dynamodb.conditions.AttributeExists object at 0x1041021f0>
<boto3.dynamodb.conditions.And object at 0x104102370>
<boto3.dynamodb.conditions.In object at 0x1041027f0>
which is not very helpful. Implementing __str__ on the boto3 Attr and ConditionBase classes will instead result in logging like:
attribute_exists(mykey)
(mykey = foo AND myotherkey = bar)
mykey IN foo
Use Case
Improved human readable logging of DynamoDB FilterExpressions
Proposed Solution
The way this is implemented is by turning an expression_format which looks like {0} {operator} {1} into something that looks like {values[0]} {operator} {values[1]} which can be passed to the string format method using named indices.
Other Information
An alternative solution would be to change all the expression_formats themselves to use a format like {values[0]} {operator} {values[1]} but that would be a larger change and require updating the end consumers of ConditionBase#get_expression.
Avoiding the regex could also be accomplished by explicitly setting a new str_expression_format field that uses a format like {values[0]} {operator} {values[1]}.
Acknowledgements
- I may be able to implement this feature request
- This feature might incur a breaking change
SDK version used
latest
Environment details (OS name and version, etc.)
all