Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
33 lines (23 sloc) 1.16 KB
layout language permalink command related_commands
api-command
Python
api/python/index_rename/
index_rename
index_create index_status index_list index_drop
index_create/
index_status/
index_list/
index_drop/

Command syntax

{% apibody %} table.index_rename(old_index_name, new_index_name[, overwrite=False]) → object {% endapibody %}

Description

Rename an existing secondary index on a table. If the optional argument overwrite is specified as True, a previously existing index with the new name will be deleted and the index will be renamed. If overwrite is False (the default) an error will be raised if the new index name already exists.

The return value on success will be an object of the format {'renamed': 1}, or {'renamed': 0} if the old and new names are the same.

An error will be raised if the old index name does not exist, if the new index name is already in use and overwrite is False, or if either the old or new index name are the same as the primary key field name.

Example: Rename an index on the comments table.

r.table('comments').index_rename('post_id', 'message_id').run(conn)
You can’t perform that action at this time.