Example #1
0
def create_projection_expression(attributes_to_get, placeholders):
    if not isinstance(attributes_to_get, list):
        attributes_to_get = [attributes_to_get]
    expressions = [
        substitute_names(_get_document_path(attribute), placeholders)
        for attribute in attributes_to_get
    ]
    return ', '.join(expressions)
Example #2
0
 def _get_path(self, path, placeholder_names):
     if isinstance(path, Path):
         split = not path.attribute_name
         return substitute_names(path.path, placeholder_names, split=split)
     elif isinstance(path, Size):
         return "size ({0})".format(
             self._get_path(path.path, placeholder_names))
     else:
         return path
Example #3
0
 def serialize(self, placeholder_names, expression_attribute_values):
     split = not self.path.attribute_name
     path = substitute_names(self.path.path, placeholder_names, split=split)
     values = [
         get_value_placeholder(value, expression_attribute_values)
         for value in self.values
     ]
     condition = self.format_string.format(*values,
                                           path=path,
                                           operator=self.operator)
     if self.logical_operator:
         other_condition = self.other_condition.serialize(
             placeholder_names, expression_attribute_values)
         return '{0} {1} {2}'.format(condition, self.logical_operator,
                                     other_condition)
     return condition
Example #4
0
 def serialize(self, placeholder_names, expression_attribute_values):
     return "size ({0})".format(
         substitute_names(self.path.path, placeholder_names))
Example #5
0
 def serialize(self, placeholder_names, expression_attribute_values):
     return substitute_names(self.path, placeholder_names)
Example #6
0
 def _serialize_value(self, value, placeholder_names,
                      expression_attribute_values):
     return substitute_names(value, placeholder_names)
Example #7
0
 def serialize(self, placeholder_names, expression_attribute_values):
     return "size ({0})".format(substitute_names(self.path.path, placeholder_names))
Example #8
0
 def serialize(self, placeholder_names, expression_attribute_values):
     return substitute_names(self.path, placeholder_names)
Example #9
0
 def _serialize_value(self, value, placeholder_names, expression_attribute_values):
     return substitute_names(value, placeholder_names)
Example #10
0
def create_projection_expression(attributes_to_get, placeholders):
    if not isinstance(attributes_to_get, list):
        attributes_to_get = [attributes_to_get]
    expression_split_pairs = [_get_expression_split_pair(attribute) for attribute in attributes_to_get]
    expressions = [substitute_names(expr, placeholders, split=split) for (expr, split) in expression_split_pairs]
    return ', '.join(expressions)