#NEWLINE# def get_sql( self , debug = False , use_cache = True ) : #NEWLINE# #INDENT# '\n        Generates the sql for this query and returns the sql as a string.\n\n        :type debug: bool\n        :param debug: If True, the sql will be returned in a format that is easier to read and debug.\n            Defaults to False\n\n        :type use_cache: bool\n        :param use_cache: If True, the query will returned the cached sql if it exists rather\n            then generating the sql again. If False, the sql will be generated again. Defaults to True.\n\n        :rtype: str\n        :return: The generated sql for this query\n        ' #NEWLINE# self . check_name_collisions ( ) #NEWLINE# if debug : #NEWLINE# #INDENT# return self . format_sql ( ) #NEWLINE# #UNINDENT# sql = '' #NEWLINE# sql += self . build_withs ( ) #NEWLINE# sql += self . build_select_fields ( ) #NEWLINE# sql += self . build_from_table ( ) #NEWLINE# sql += self . build_joins ( ) #NEWLINE# sql += self . build_where ( ) #NEWLINE# sql += self . build_groups ( ) #NEWLINE# sql += self . build_order_by ( ) #NEWLINE# sql += self . build_limit ( ) #NEWLINE# self . sql = sql . strip ( ) #NEWLINE# return use_cache . sql