예제 #1
0
 def rebuild_table(self, adapter):
     config = adapter.config
     if not config.is_static:
         latest_rev = config.get_db().get_rev(config._id)
         if config._rev != latest_rev:
             raise StaleRebuildError('Tried to rebuild a stale table ({})! Ignoring...'.format(config))
     adapter.rebuild_table()
     if config.is_static:
         rebuild_indicators.delay(adapter.config.get_id)
예제 #2
0
    def rebuild_table(self, adapter, diffs=None):
        config = adapter.config
        if not config.is_static:
            latest_rev = config.get_db().get_rev(config._id)
            if config._rev != latest_rev:
                raise StaleRebuildError('Tried to rebuild a stale table ({})! Ignoring...'.format(config))

        diff_dicts = [diff.to_dict() for diff in diffs]
        if config.disable_destructive_rebuild and adapter.table_exists:
            adapter.log_table_rebuild_skipped(source='pillowtop', diffs=diff_dicts)
            return

        rebuild_indicators.delay(adapter.config.get_id, source='pillowtop', engine_id=adapter.engine_id, diffs=diff_dicts)