'Reformats the query into the create table as query.
Works only for the single select SQL statements, in all other cases
the sql query is not modified.
:param superset_query: string, sql query that will be executed
:param table_name: string, will contain the results of the
query execution
:param overwrite, boolean, table table_name will be dropped if true
:return: string, create table as query'

def as_create_table(self, table_name, overwrite=False):

    exec_sql = ''
    sql = self.stripped()
    if overwrite:
        exec_sql = 'DROP    TABLE    IF    EXISTS    {table_name};\n'
    exec_sql += 'CREATE    TABLE    {table_name}    AS    \n{sql}'
    return exec_sql.format(**locals())
