in boto3/dynamodb/conditions.py [0:0]
def _build_expression_component(self, value, attribute_name_placeholders,
attribute_value_placeholders,
has_grouped_values, is_key_condition):
# Continue to recurse if the value is a ConditionBase in order
# to extract out all parts of the expression.
if isinstance(value, ConditionBase):
return self._build_expression(
value, attribute_name_placeholders,
attribute_value_placeholders, is_key_condition)
# If it is not a ConditionBase, we can recurse no further.
# So we check if it is an attribute and add placeholders for
# its name
elif isinstance(value, AttributeBase):
if is_key_condition and not isinstance(value, Key):
raise DynamoDBNeedsKeyConditionError(
'Attribute object %s is of type %s. '
'KeyConditionExpression only supports Attribute objects '
'of type Key' % (value.name, type(value)))
return self._build_name_placeholder(
value, attribute_name_placeholders)
# If it is anything else, we treat it as a value and thus placeholders
# are needed for the value.
else:
return self._build_value_placeholder(
value, attribute_value_placeholders, has_grouped_values)