(self, curs)
return res
Find GP distribution keys
Find GP distribution keys
Find GP distribution keys
def find_dist_fields(self, curs):
        """Find GP distribution keys"""
        if not skytools.exists_table(curs, "pg_catalog.gp_distribution_policy"):
            return []
        schema, name = skytools.fq_name_parts(self.table)
        qry = "select a.attname"\
            "  from pg_class t, pg_namespace n, pg_attribute a,"\
            "       gp_distribution_policy p"\
            " where n.oid = t.relnamespace"\
            "   and p.localoid = t.oid"\
            "   and a.attrelid = t.oid"\
            "   and a.attnum = any(p.attrnums)"\
            "   and n.nspname = %s and t.relname = %s"
        curs.execute(qry, [schema, name])
        res = []
        for row in curs.fetchall():
            res.append(row[0])
        return res
def find_dist_fields ( self , curs ) : if not skytools . exists_table ( curs , "pg_catalog.gp_distribution_policy" ) : return [ ] schema , name = skytools . fq_name_parts ( self . table ) qry = "select a.attname" "  from pg_class t, pg_namespace n, pg_attribute a," "       gp_distribution_policy p" " where n.oid = t.relnamespace" "   and p.localoid = t.oid" "   and a.attrelid = t.oid" "   and a.attnum = any(p.attrnums)" "   and n.nspname = %s and t.relname = %s" curs . execute ( qry , [ schema , name ] ) res = [ ] for row in curs . fetchall ( ) : res . append ( row [ 0 ] ) return res