'Rebuild this hierarchy from the target table'

def read(self):

    tablename = self.tablename
    if (not tablename):
        return
    s3db = current.s3db
    table = s3db[tablename]
    pkey = self.pkey
    fkey = self.fkey
    ckey = self.ckey
    fields = [pkey, fkey]
    if (ckey is not None):
        fields.append(table[ckey])
    if ('deleted' in table):
        query = (table.deleted != True)
    else:
        query = (table.id > 0)
    rows = current.db(query).select(left=self.left, *fields)
    self.__theset.clear()
    add = self.add
    cfield = table[ckey]
    for row in rows:
        n = row[pkey]
        p = row[fkey]
        if ckey:
            c = row[cfield]
        else:
            c = None
        add(n, parent_id=p, category=c)
    self.__status(dirty=False, dbupdate=True)
    self.__roots = None
    self.__nodes = None
    return
