def handle(self, *args, **options): qn = connection.ops.quote_name query = 'SELECT %(id)s FROM %(table)s ORDER BY %(id)s' query = query % { 'table' : qn(Book._meta.db_table), 'id' : qn('id'), } args = ('','') rebuild_search_index(query, args, self.help)