o ckF[d ã@sÂddlmZGdd„deƒZGdd„deƒZGdd„deƒZGdd „d eƒZGd d „d eƒZGd d „d eƒZGdd„deƒZ Gdd„deƒZ Gdd„de ƒZ Gdd„de ƒZ Gdd„de e ƒZ dS)é)ÚSTRINGc@s0eZdZdZdZefdd„Zdd„Zdd„ZdS) ÚBaseSchemaFieldz´ An abstract class for defining schema fields. Contains most of the core functionality for the field. Subclasses must define an ``attr_type`` to pass to DynamoDB. NcCs||_||_dS)aN Creates a Python schema field, to represent the data to pass to DynamoDB. Requires a ``name`` parameter, which should be a string name of the field. Optionally accepts a ``data_type`` parameter, which should be a constant from ``boto.dynamodb2.types``. (Default: ``STRING``) N©ÚnameÚ data_type)Úselfrr©rú7/usr/lib/python3/dist-packages/boto/dynamodb2/fields.pyÚ__init__ s zBaseSchemaField.__init__cCó|j|jdœS)zõ Returns the attribute definition structure DynamoDB expects. Example:: >>> field.definition() { 'AttributeName': 'username', 'AttributeType': 'S', } ©Ú AttributeNameÚ AttributeTyper©rrrr Ú definitionóþzBaseSchemaField.definitioncCr )zà Returns the schema structure DynamoDB expects. Example:: >>> field.schema() { 'AttributeName': 'username', 'KeyType': 'HASH', } )r ÚKeyType)rÚ attr_typerrrr Úschema-rzBaseSchemaField.schema) Ú__name__Ú __module__Ú __qualname__Ú__doc__rrr rrrrrr rs   rc@óeZdZdZdZdS)ÚHashKeyzÅ An field representing a hash key. Example:: >>> from boto.dynamodb2.types import NUMBER >>> HashKey('username') >>> HashKey('date_joined', data_type=NUMBER) ÚHASHN©rrrrrrrrr r@ó rc@r)ÚRangeKeyzÆ An field representing a range key. Example:: >>> from boto.dynamodb2.types import NUMBER >>> HashKey('username') >>> HashKey('date_joined', data_type=NUMBER) ÚRANGENrrrrr rNrrc@s(eZdZdZdd„Zdd„Zdd„ZdS) ÚBaseIndexFieldzº An abstract class for defining schema indexes. Contains most of the core functionality for the index. Subclasses must define a ``projection_type`` to pass to DynamoDB. cCs||_||_dS©N)rÚparts)rrr"rrr r cs zBaseIndexField.__init__cCs(g}|jD] }| |j|jdœ¡q|S)zõ Returns the attribute definition structure DynamoDB expects. Example:: >>> index.definition() { 'AttributeName': 'username', 'AttributeType': 'S', } r )r"Úappendrr)rrÚpartrrr rgs  þzBaseIndexField.definitioncCs2g}|jD] }| | ¡¡q|j|d|jidœS)aâ Returns the schema structure DynamoDB expects. Example:: >>> index.schema() { 'IndexName': 'LastNameIndex', 'KeySchema': [ { 'AttributeName': 'username', 'KeyType': 'HASH', }, ], 'Projection': { 'ProjectionType': 'KEYS_ONLY', } } ÚProjectionType)Ú IndexNameÚ KeySchemaÚ Projection)r"r#rrÚprojection_type)rÚ key_schemar$rrr r~s ÿýzBaseIndexField.schemaN)rrrrr rrrrrr r \s  r c@r)ÚAllIndexzà An index signifying all fields should be in the index. Example:: >>> AllIndex('MostRecentlyJoined', parts=[ ... HashKey('username'), ... RangeKey('date_joined') ... ]) ÚALLN©rrrrr)rrrr r+¡ó r+c@r)Ú KeysOnlyIndexzê An index signifying only key fields should be in the index. Example:: >>> KeysOnlyIndex('MostRecentlyJoined', parts=[ ... HashKey('username'), ... RangeKey('date_joined') ... ]) Ú KEYS_ONLYNr-rrrr r/°r.r/cs0eZdZdZdZ‡fdd„Z‡fdd„Z‡ZS)Ú IncludeIndexzû An index signifying only certain fields should be in the index. Example:: >>> IncludeIndex('GenderIndex', parts=[ ... HashKey('username'), ... RangeKey('date_joined') ... ], includes=['gender']) ÚINCLUDEcs(| dg¡|_tt|ƒj|i|¤ŽdS)NÚincludes)ÚpopÚincludes_fieldsÚsuperr1r )rÚargsÚkwargs©Ú __class__rr r ÍszIncludeIndex.__init__cs tt|ƒ ¡}|j|dd<|S)Nr(ÚNonKeyAttributes)r6r1rr5©rÚ schema_datar9rr rÑszIncludeIndex.schema)rrrrr)r rÚ __classcell__rrr9r r1¿s  r1cs6eZdZdZdddœZ‡fdd„Z‡fdd„Z‡ZS)ÚGlobalBaseIndexFieldzº An abstract class for defining global indexes. Contains most of the core functionality for the index. Subclasses must define a ``projection_type`` to pass to DynamoDB. é)ÚreadÚwritecs4| dd¡}|dur ||_tt|ƒj|i|¤ŽdS©NÚ throughput)r4rDr6r?r ©rr7r8rDr9rr r ãs zGlobalBaseIndexField.__init__cs4tt|ƒ ¡}t|jdƒt|jdƒdœ|d<|S)ax Returns the schema structure DynamoDB expects. Example:: >>> index.schema() { 'IndexName': 'LastNameIndex', 'KeySchema': [ { 'AttributeName': 'username', 'KeyType': 'HASH', }, ], 'Projection': { 'ProjectionType': 'KEYS_ONLY', }, 'ProvisionedThroughput': { 'ReadCapacityUnits': 5, 'WriteCapacityUnits': 5 } } rArB)ÚReadCapacityUnitsÚWriteCapacityUnitsÚProvisionedThroughput)r6r?rÚintrDr<r9rr rës    þzGlobalBaseIndexField.schema)rrrrrDr rr>rrr9r r?×sþ r?c@r)ÚGlobalAllIndexaE An index signifying all fields should be in the index. Example:: >>> GlobalAllIndex('MostRecentlyJoined', parts=[ ... HashKey('username'), ... RangeKey('date_joined') ... ], ... throughput={ ... 'read': 2, ... 'write': 1, ... }) r,Nr-rrrr rJ órJc@r)ÚGlobalKeysOnlyIndexaO An index signifying only key fields should be in the index. Example:: >>> GlobalKeysOnlyIndex('MostRecentlyJoined', parts=[ ... HashKey('username'), ... RangeKey('date_joined') ... ], ... throughput={ ... 'read': 2, ... 'write': 1, ... }) r0Nr-rrrr rLrKrLc@s$eZdZdZdZdd„Zdd„ZdS)ÚGlobalIncludeIndexal An index signifying only certain fields should be in the index. Example:: >>> GlobalIncludeIndex('GenderIndex', parts=[ ... HashKey('username'), ... RangeKey('date_joined') ... ], ... includes=['gender'], ... throughput={ ... 'read': 2, ... 'write': 1, ... }) r2cOsL| dd¡}tj|g|¢Ri|¤Ž|r||d<tj|g|¢Ri|¤ŽdSrC)r4r1r r?rErrr r Es zGlobalIncludeIndex.__init__cCst |¡}| t |¡¡|Sr!)r1rÚupdater?r<rrr rLs zGlobalIncludeIndex.schemaN)rrrrr)r rrrrr rM2s  rMN)Úboto.dynamodb2.typesrÚobjectrrrr r+r/r1r?rJrLrMrrrr Ús <E5