firstprayer / monsql

MonSQL - Light-weighted, MongoDB-style Wrapper for multiple Relational Databases
MIT License
2 stars 2 forks source link

Support MapReduce #15

Open firstprayer opened 9 years ago

firstprayer commented 9 years ago

My idea is like this:

add a method mapreduce to the Table class:

def mapreduce(self, map_keys, reduce, prefilter=None, postfilter=None):
    """
    map_keys: a list or tuple of column names
    reduce: a dictionary of {name -> expression}. For example: {'people_num': {'$count': 'id'}}
    prefilter: filter out rows before map phase
    postfilter: filter out results after reduce phase
    return: a list of RowData
    """
    ...