(self, type=str, primary_key=None, composite_key=None, index=None,
                 required=None, enum=None, sort=None)
primary_key can exist in only a single column.
        composite_key can exist in multiple columns.
        You can't have both a primary_key and composite_key in the same model.
        index is whether you want this column indexed or not for faster retrieval.
primary_key can exist in only a single column.
        composite_key can exist in multiple columns.
        You can't have both a primary_key and composite_key in the same model.
        index is whether you want this column indexed or not for faster retrieval.
primary_key can exist in only a single column . composite_key can exist in multiple columns . You can t have both a primary_key and composite_key in the same model . index is whether you want this column indexed or not for faster retrieval .
def __init__(self, type=str, primary_key=None, composite_key=None, index=None,
                 required=None, enum=None, sort=None):
        """primary_key can exist in only a single column.
        composite_key can exist in multiple columns.
        You can't have both a primary_key and composite_key in the same model.
        index is whether you want this column indexed or not for faster retrieval.
        """
        if type not in (str, int, datetime):
            # TODO: support for other field types (uuid, etc)
            err_msg = 'Bad Field Type: {}'.format(type)
            raise InvalidColumnDefinition(err_msg)

        if primary_key and composite_key:
            err_msg = 'Column can be either primary_key or composite_key, but not both'
            raise InvalidColumnDefinition(err_msg)

        self.field_type = type
        self.primary = primary_key is True
        self.composite = composite_key is True
        self.sorted = sort is True
        self.indexed = (index is True) or self.composite
        self.required = required is True or self.primary or self.composite

        self.enum = enum
        if enum:
            if not isinstance(enum, EnumMeta):
                err_msg = '`{}` is not an instance of {}'.format(enum, EnumMeta)
                raise InvalidColumnDefinition(err_msg)
            self.enum_choices = set([x.value for x in enum])
        else:
            self.enum_choices = set()
def __init__ ( self , type = str , primary_key = None , composite_key = None , index = None , required = None , enum = None , sort = None ) : if type not in ( str , int , datetime ) : # TODO: support for other field types (uuid, etc) err_msg = 'Bad Field Type: {}' . format ( type ) raise InvalidColumnDefinition ( err_msg ) if primary_key and composite_key : err_msg = 'Column can be either primary_key or composite_key, but not both' raise InvalidColumnDefinition ( err_msg ) self . field_type = type self . primary = primary_key is True self . composite = composite_key is True self . sorted = sort is True self . indexed = ( index is True ) or self . composite self . required = required is True or self . primary or self . composite self . enum = enum if enum : if not isinstance ( enum , EnumMeta ) : err_msg = '`{}` is not an instance of {}' . format ( enum , EnumMeta ) raise InvalidColumnDefinition ( err_msg ) self . enum_choices = set ( [ x . value for x in enum ] ) else : self . enum_choices = set ( )