ó FRTc@s ddlmZdefd„ƒYZdefd„ƒYZdefd„ƒYZdefd „ƒYZd efd „ƒYZd efd „ƒYZdefd„ƒYZ defd„ƒYZ de fd„ƒYZ de fd„ƒYZ de e fd„ƒYZ dS(i˙˙˙˙(tSTRINGtBaseSchemaFieldcBs2eZdZdZed„Zd„Zd„ZRS(s´ 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. cCs||_||_dS(sN 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(tnamet data_type(tselfRR((sB/opt/freeware/lib/python2.7/site-packages/boto/dynamodb2/fields.pyt__init__ s cCsi|jd6|jd6S(ső Returns the attribute definition structure DynamoDB expects. Example:: >>> field.definition() { 'AttributeName': 'username', 'AttributeType': 'S', } t AttributeNamet AttributeType(RR(R((sB/opt/freeware/lib/python2.7/site-packages/boto/dynamodb2/fields.pyt definitions  cCsi|jd6|jd6S(sŕ Returns the schema structure DynamoDB expects. Example:: >>> field.schema() { 'AttributeName': 'username', 'KeyType': 'HASH', } RtKeyType(Rt attr_type(R((sB/opt/freeware/lib/python2.7/site-packages/boto/dynamodb2/fields.pytschema-s  N( t__name__t __module__t__doc__tNoneR RRRR (((sB/opt/freeware/lib/python2.7/site-packages/boto/dynamodb2/fields.pyRs   tHashKeycBseZdZdZRS(sĹ An field representing a hash key. Example:: >>> from boto.dynamodb2.types import NUMBER >>> HashKey('username') >>> HashKey('date_joined', data_type=NUMBER) tHASH(R R RR (((sB/opt/freeware/lib/python2.7/site-packages/boto/dynamodb2/fields.pyR@s tRangeKeycBseZdZdZRS(sĆ An field representing a range key. Example:: >>> from boto.dynamodb2.types import NUMBER >>> HashKey('username') >>> HashKey('date_joined', data_type=NUMBER) tRANGE(R R RR (((sB/opt/freeware/lib/python2.7/site-packages/boto/dynamodb2/fields.pyRNs tBaseIndexFieldcBs)eZdZd„Zd„Zd„ZRS(sş 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(Rtparts(RRR((sB/opt/freeware/lib/python2.7/site-packages/boto/dynamodb2/fields.pyRcs cCs?g}x2|jD]'}|ji|jd6|jd6ƒqW|S(ső Returns the attribute definition structure DynamoDB expects. Example:: >>> index.definition() { 'AttributeName': 'username', 'AttributeType': 'S', } RR(RtappendRR(RRtpart((sB/opt/freeware/lib/python2.7/site-packages/boto/dynamodb2/fields.pyRgs   cCsSg}x$|jD]}|j|jƒƒqWi|jd6|d6i|jd6d6S(sâ Returns the schema structure DynamoDB expects. Example:: >>> index.schema() { 'IndexName': 'LastNameIndex', 'KeySchema': [ { 'AttributeName': 'username', 'KeyType': 'HASH', }, ], 'Projection': { 'ProjectionType': 'KEYS_ONLY', } } t IndexNamet KeySchematProjectionTypet Projection(RRR Rtprojection_type(Rt key_schemaR((sB/opt/freeware/lib/python2.7/site-packages/boto/dynamodb2/fields.pyR ~s (R R RRRR (((sB/opt/freeware/lib/python2.7/site-packages/boto/dynamodb2/fields.pyR\s  tAllIndexcBseZdZdZRS(sŕ An index signifying all fields should be in the index. Example:: >>> AllIndex('MostRecentlyJoined', parts=[ ... HashKey('username'), ... RangeKey('date_joined') ... ]) tALL(R R RR(((sB/opt/freeware/lib/python2.7/site-packages/boto/dynamodb2/fields.pyRĄs t KeysOnlyIndexcBseZdZdZRS(sę An index signifying only key fields should be in the index. Example:: >>> KeysOnlyIndex('MostRecentlyJoined', parts=[ ... HashKey('username'), ... RangeKey('date_joined') ... ]) t KEYS_ONLY(R R RR(((sB/opt/freeware/lib/python2.7/site-packages/boto/dynamodb2/fields.pyR °s t IncludeIndexcBs&eZdZdZd„Zd„ZRS(sű An index signifying only certain fields should be in the index. Example:: >>> IncludeIndex('GenderIndex', parts=[ ... HashKey('username'), ... RangeKey('date_joined') ... ], includes=['gender']) tINCLUDEcOs2|jdgƒ|_tt|ƒj||ŽdS(Ntincludes(tpoptincludes_fieldstsuperR"R(Rtargstkwargs((sB/opt/freeware/lib/python2.7/site-packages/boto/dynamodb2/fields.pyRÍscCs*tt|ƒjƒ}|j|dd<|S(NRtNonKeyAttributes(R'R"R R&(Rt schema_data((sB/opt/freeware/lib/python2.7/site-packages/boto/dynamodb2/fields.pyR Ńs(R R RRRR (((sB/opt/freeware/lib/python2.7/site-packages/boto/dynamodb2/fields.pyR"żs  tGlobalBaseIndexFieldcBs4eZdZidd6dd6Zd„Zd„ZRS(sş 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. itreadtwritecOsG|jddƒ}|dk r*||_ntt|ƒj||ŽdS(Nt throughput(R%RR/R'R,R(RR(R)R/((sB/opt/freeware/lib/python2.7/site-packages/boto/dynamodb2/fields.pyRăs  cCsKtt|ƒjƒ}it|jdƒd6t|jdƒd6|d<|S(sx 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 } } R-tReadCapacityUnitsR.tWriteCapacityUnitstProvisionedThroughput(R'R,R tintR/(RR+((sB/opt/freeware/lib/python2.7/site-packages/boto/dynamodb2/fields.pyR ës (R R RR/RR (((sB/opt/freeware/lib/python2.7/site-packages/boto/dynamodb2/fields.pyR,×s   tGlobalAllIndexcBseZdZdZRS(sE 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(R R RR(((sB/opt/freeware/lib/python2.7/site-packages/boto/dynamodb2/fields.pyR4 stGlobalKeysOnlyIndexcBseZdZdZRS(sO 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, ... }) R!(R R RR(((sB/opt/freeware/lib/python2.7/site-packages/boto/dynamodb2/fields.pyR5stGlobalIncludeIndexcBs&eZdZdZd„Zd„ZRS(sl 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, ... }) R#cOsO|jddƒ}tj|||Ž|r8||ds<E5