Esempio n. 1
0
    def rename(self, name, connection=None, **kwargs):
        """Rename this table.

        :param name: New name of the table.
        :type name: string
        :param connection: reuse connection istead of creating new one.
        :type connection: :class:`sqlalchemy.engine.base.Connection` instance
        """
        engine = self.bind
        self.new_name = name
        visitorcallable = get_engine_visitor(engine, 'schemachanger')
        run_single_visitor(engine, visitorcallable, self, connection, **kwargs)

        # Fix metadata registration
        self.name = name
        self.deregister()
        self._set_parent(self.metadata)
Esempio n. 2
0
 def __do_imports(self, visitor_name, *a, **kw):
     engine = kw.pop('engine', self.table.bind)
     from promogest.lib.migrate.changeset.databases.visitor import (get_engine_visitor,
                                                      run_single_visitor)
     visitorcallable = get_engine_visitor(engine, visitor_name)
     run_single_visitor(engine, visitorcallable, self, *a, **kw)