(self, curs, new_name = None)
return sql
Generate creation SQL.
Generate creation SQL.
Generate creation SQL .
def get_create_sql(self, curs, new_name = None):
        """Generate creation SQL."""
        if not new_name:
            new_name = self.name
        sql = "CREATE TABLE %s (" % quote_fqident(new_name)
        sep = "\n    "
        for c in self.col_list:
            sql += sep + c.column_def
            sep = ",\n    "
        sql += "\n)"
        if self.dist_key_list is not None:
            if self.dist_key_list != []:
                sql += "\ndistributed by(%s)" % ','.join(c.name for c
                                                         in self.dist_key_list)
            else:
                sql += '\ndistributed randomly'

        sql += ";"
        return sql
def get_create_sql ( self , curs , new_name = None ) : if not new_name : new_name = self . name sql = "CREATE TABLE %s (" % quote_fqident ( new_name ) sep = "\n    " for c in self . col_list : sql += sep + c . column_def sep = ",\n    " sql += "\n)" if self . dist_key_list is not None : if self . dist_key_list != [ ] : sql += "\ndistributed by(%s)" % ',' . join ( c . name for c in self . dist_key_list ) else : sql += '\ndistributed randomly' sql += ";" return sql