def parse_multiple_query(self, param): tables = [] condition = true() order_by = [] group_by = [] limit = __default_limit__ total = None page = 0 columns = [] for k, v in param.items(): if isinstance(v, dict): # Schema c = self.parse_param(k, v) tables.append(c.table) columns.extend(c.columns) condition = c.condition & condition if c.relation is not None: condition = c.relation & condition else: if k.startswith('@'): if k == '@limit': limit = v elif k == '@page': page = v elif k == '@order_by': if isinstance(v, (str, unicode)): orders = v.split(',') else: orders = v for c in orders: if '.' in c: v = c.split('.') if len(v) == 3: schema_name, col_name, dir = v else: schema_name, col_name = v dir = 'asc' else: col_name = c dir = 'asc' S = get_schema(schema_name) col = S.get_column(col_name) if dir == 'desc': order_by.append(col.desc()) else: order_by.append(col) elif k == '@group_by': if isinstance(v, (str, unicode)): groups = v.split(',') else: groups = v for c in groups: if '.' in c: schema_name, col_name = c.split('.') S = get_schema(schema_name) col = S.get_column(col_name) group_by.append(col) elif k == '@total': total = v config = Storage({}) config.tables = tables config.condition = condition config.columns = columns config.order_by = order_by config.group_by = group_by config.page = page config.limit = limit config.total = total return config