flywheel.fields.indexes module¶
Index definitions
- class flywheel.fields.indexes.GlobalIndex(name, hash_key, range_key=None)[source]¶
Bases: object
A global index for DynamoDB
Parameters: name : str
The name of the index
hash_key : str
The name of the field that is the hash key for the index
range_key : str, optional
The name of the field that is the range key for the index
throughput : dict, optional
The read/write throughput of this global index. Used when creating a table. Dict has a ‘read’ and a ‘write’ key. (Default 5, 5)
- classmethod include(name, hash_key, range_key=None, includes=None)[source]¶
Select which attributes to project into the index
- throughput(read=5, write=5)[source]¶
Set the index throughput
Parameters: read : int, optional
Amount of read throughput (default 5)
write : int, optional
Amount of write throughput (default 5)
Notes
This is meant to be used as a chain:
class MyModel(Model): __metadata__ = { 'global_indexes': [ GlobalIndex('myindex', 'hkey', 'rkey').throughput(5, 2) ] }