#NEWLINE# def build_order_by( self , use_alias = True ) : #NEWLINE# #INDENT# '\n        Generates the sql for the ORDER BY portion of the query\n\n        :type use_alias: bool\n        :param use_alias: If True, the alias for the field will be used in the order by.\n            This is an option before query windows do not use the alias. Defaults to True.\n\n        :return: the ORDER BY portion of the query\n        :rtype: str\n        ' #NEWLINE# if len ( use_alias . sorters ) : #NEWLINE# #INDENT# sorters = [ ] #NEWLINE# for sorter in self . sorters : #NEWLINE# #INDENT# sorters . append ( sorter . get_name ( use_alias = use_alias ) ) #NEWLINE# #UNINDENT# return 'ORDER BY {0} ' . format ( ', ' . join ( sorters ) ) #NEWLINE# #UNINDENT# return ''