#NEWLINE# def GenerateRangeWhere( self , start_key , end_key ) : #NEWLINE# #INDENT# 'Given a start and end, generate a where clause to select a range.\n\n    Return a where clause that SELECTs all rows between start_key and end_key.\n    This is somewhat tricky for multiple column PRIMARY KEYs since the\n    WHERE clause depends on which columns between the two keys differ.\n\n    The expression below first generates an equality match for all columns in a\n    continuous path from the beginning of the key that are the same, i.e. the\n    common parent tree between start and end keys.\n\n    For the first column that varies, it then generates three sets and takes the\n    union of them: the "left" tree under the starting value, the set of rows\n    between the start and end values, and the "right" tree under the ending\n    value.\n\n    Args:\n      start_key: (dict) PRIMARY KEY value that identifies the first row.\n      end_key: (dict) PRIMARY KEY value that identifies the last row.\n    Returns:\n      A string WHERE clause for the appropriate Range select.\n    ' #NEWLINE# cols = list ( self . _table . GetPrimaryKey ( ) ) #NEWLINE# return '' . join ( ( '(' , self . _GenerateRangePredicate ( start_key , end_key , cols ) , ' AND (' , self . _GenerateRangeSide ( start_key , '>' , cols ) , ' OR ' , self . _GenerateRangeCenter ( start_key , end_key , cols ) , ' OR ' , self . _GenerateRangeSide ( end_key , '<' , cols ) , '))' ) )