cubes_lite/sql/query.py
def order_query(statement, order, columns=None, mapper=None):
        """Returns a SQL statement which is ordered according to the `order`.

        * `statement` - statement to be ordered
        * `order` explicit order, list of tuples (`attribute`, `direction`)
        """

        if not order:
            return statement

        final_order = OrderedDict()
        for attribute, direction in order:
            if isinstance(attribute, Aggregate):
                name = attribute.public_name
            else:
                name = attribute.ref

            if name not in final_order:
                source_column = None
                if mapper:
                    source_column = mapper.get_column_by_attribute(attribute)
                if columns:
                    source_column = columns[name]
                if source_column is None:
                    raise ValueError('No such column: "{}"'.format(name))

                column = SQLQueryBuilder.order_column(source_column, direction)
                final_order[name] = column

        statement = statement.order_by(*final_order.values())
        return statement
Returns a SQL statement which is ordered according to the `order`.

        * `statement` - statement to be ordered
        * `order` explicit order, list of tuples (`attribute`, `direction`)
        
Returns a SQL statement which is ordered according to the `order`.
Returns a SQL statement which is ordered according to the ` order ` .
def order_query(statement, order, columns=None, mapper=None):
        if not order:
            return statement
        final_order = OrderedDict()
        for attribute, direction in order:
            if isinstance(attribute, Aggregate):
                name = attribute.public_name
            else:
                name = attribute.ref
            if name not in final_order:
                source_column = None
                if mapper:
                    source_column = mapper.get_column_by_attribute(attribute)
                if columns:
                    source_column = columns[name]
                if source_column is None:
                    raise ValueError('No such column: "{}"'.format(name))
                column = SQLQueryBuilder.order_column(source_column, direction)
                final_order[name] = column
        statement = statement.order_by(*final_order.values())
        return statement
def order_query ( statement , order , columns = None , mapper = None ) : if not order : return statement final_order = OrderedDict ( ) for attribute , direction in order : if isinstance ( attribute , Aggregate ) : name = attribute . public_name else : name = attribute . ref if name not in final_order : source_column = None if mapper : source_column = mapper . get_column_by_attribute ( attribute ) if columns : source_column = columns [ name ] if source_column is None : raise ValueError ( 'No such column: "{}"' . format ( name ) ) column = SQLQueryBuilder . order_column ( source_column , direction ) final_order [ name ] = column statement = statement . order_by ( * final_order . values ( ) ) return statement
Returns a SQL statement which is ordered according to the `order`.
Returns a SQL statement which is ordered according to the ` order ` .
"""Returns a SQL statement which is ordered according to the `order`.

        * `statement` - statement to be ordered
        * `order` explicit order, list of tuples (`attribute`, `direction`)
        """
statement
order
columns
mapper