(self, curs, new_table_name = None)
return sql
Generate creation SQL.
Generate creation SQL.
Generate creation SQL .
def get_create_sql(self, curs, new_table_name = None):
        """Generate creation SQL."""
        if new_table_name:
            # fixme: seems broken
            iname = find_new_name(curs, self.name)
            tname = new_table_name
            pnew = "INDEX %s ON %s " % (quote_ident(iname), quote_fqident(tname))
            rx = r"\bINDEX[ ][a-z0-9._]+[ ]ON[ ][a-z0-9._]+[ ]"
            sql = rx_replace(rx, self.defn, pnew)
        else:
            sql = self.defn
            iname = self.local_name
            tname = self.table_name
        if self.is_clustered:
            sql += ' ALTER TABLE ONLY %s\n  CLUSTER ON %s;' % (
                quote_fqident(tname), quote_ident(iname))
        return sql
def get_create_sql ( self , curs , new_table_name = None ) : if new_table_name : # fixme: seems broken iname = find_new_name ( curs , self . name ) tname = new_table_name pnew = "INDEX %s ON %s " % ( quote_ident ( iname ) , quote_fqident ( tname ) ) rx = r"\bINDEX[ ][a-z0-9._]+[ ]ON[ ][a-z0-9._]+[ ]" sql = rx_replace ( rx , self . defn , pnew ) else : sql = self . defn iname = self . local_name tname = self . table_name if self . is_clustered : sql += ' ALTER TABLE ONLY %s\n  CLUSTER ON %s;' % ( quote_fqident ( tname ) , quote_ident ( iname ) ) return sql