1. Ludia
  2. Untitled project
  3. dynamodb-mapper

Commits

Max Noel  committed 823da69

* query and scan now return generators.

  • Participants
  • Parent commits 663b245
  • Branches default

Comments (0)

Files changed (1)

File dynamodb_mapper/model.py

View file
  • Ignore whitespace
         :param range_key_condition: A condition instance from
             boto.dynamodb.condition -- one of EQ(x), LE(x), LT(x), GE(x),
             GT(x), BEGINS_WITH(x), BETWEEN(x, y).
+
+        :rtype: generator
         """
         table = ConnectionBorg().get_table(cls.__table__)
-        return [
+        return (
             cls.from_dict(d)
             for d in table.query(hash_key_value, range_key_condition)
-        ]
+        )
 
     @classmethod
     def scan(cls, scan_filter=None):
 
         :param scan_filter: A {attribute_name: condition} dict, where
             condition is a condition instance from boto.dynamodb.condition.
+
+        :rtype: generator
         """
         table = ConnectionBorg().get_table(cls.__table__)
-        return [
+        return (
             cls.from_dict(d)
             for d in table.scan(scan_filter)
-        ]
+        )
 
     def __init__(self):
         """Create a default empty instance of the class with default values