(self, old_key, new_relation)
return True
Rename a relation named old_key to new_key, updating references.
        Return whether or not there was a key to rename.

        :param _ReferenceKey old_key: The existing key, to rename from.
        :param _CachedRelation new_key: The new relation, to rename to.
Rename a relation named old_key to new_key, updating references.
        Return whether or not there was a key to rename.
Rename a relation named old_key to new_key updating references . Return whether or not there was a key to rename .
def _rename_relation(self, old_key, new_relation):
        """Rename a relation named old_key to new_key, updating references.
        Return whether or not there was a key to rename.

        :param _ReferenceKey old_key: The existing key, to rename from.
        :param _CachedRelation new_key: The new relation, to rename to.
        """
        # On the database level, a rename updates all values that were
        # previously referenced by old_name to be referenced by new_name.
        # basically, the name changes but some underlying ID moves. Kind of
        # like an object reference!
        relation = self.relations.pop(old_key)
        new_key = new_relation.key()

        # relaton has to rename its innards, so it needs the _CachedRelation.
        relation.rename(new_relation)
        # update all the relations that refer to it
        for cached in self.relations.values():
            if cached.is_referenced_by(old_key):
                fire_event(
                    UpdateReference(old_key=old_key, new_key=new_key, cached_key=cached.key())
                )
                cached.rename_key(old_key, new_key)

        self.relations[new_key] = relation
        # also fixup the schemas!
        self.add_schema(new_key.database, new_key.schema)

        return True
def _rename_relation ( self , old_key , new_relation ) : # On the database level, a rename updates all values that were # previously referenced by old_name to be referenced by new_name. # basically, the name changes but some underlying ID moves. Kind of # like an object reference! relation = self . relations . pop ( old_key ) new_key = new_relation . key ( ) # relaton has to rename its innards, so it needs the _CachedRelation. relation . rename ( new_relation ) # update all the relations that refer to it for cached in self . relations . values ( ) : if cached . is_referenced_by ( old_key ) : fire_event ( UpdateReference ( old_key = old_key , new_key = new_key , cached_key = cached . key ( ) ) ) cached . rename_key ( old_key , new_key ) self . relations [ new_key ] = relation # also fixup the schemas! self . add_schema ( new_key . database , new_key . schema ) return True