def as_create_table(self, table_name, overwrite=False):
    'Reformats the query into the create table as query.\n\n        Works only for the single select SQL statements, in all other cases\n        the sql query is not modified.\n        :param superset_query: string, sql query that will be executed\n        :param table_name: string, will contain the results of the\n            query execution\n        :param overwrite, boolean, table table_name will be dropped if true\n        :return: string, create table as query\n        '
    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())
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):
    'Reformats the query into the create table as query.\n\n        Works only for the single select SQL statements, in all other cases\n        the sql query is not modified.\n        :param superset_query: string, sql query that will be executed\n        :param table_name: string, will contain the results of the\n            query execution\n        :param overwrite, boolean, table table_name will be dropped if true\n        :return: string, create table as query\n        '
    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())