Rename a table

更新时间:
复制 MD 格式

Rename a table in a table bucket or move it to a different namespace.

Notes

  • You must specify at least one of the --new-name or --new-namespace parameters. If you specify only --new-name, the table is renamed within its current namespace. If you specify only --new-namespace, the table is moved to the new namespace but retains its original name. If you specify both parameters, the table is renamed and moved to the new namespace.

  • --version-token enables optimistic locking. You can get a table's current versionToken by using the get-table command to prevent update conflicts during concurrent operations. If you do not specify this parameter, no version check is performed.

Syntax

ossutil tables-api rename-table --table-bucket-arn value --namespace value --name value [--new-name value] [--new-namespace value] [--version-token value] [flags]

Parameter

Type

Description

--name

string

The current table name. Required.

--namespace

string

The table's current namespace. Required.

--new-name

string

The new name for the table. You must specify at least one of --new-name or --new-namespace.

--new-namespace

string

The target namespace for the table. You must specify at least one of --new-name or --new-namespace.

--table-bucket-arn

string

The Alibaba Cloud Resource Name (ARN) of the table bucket, in the format acs:osstables:{region}:{uid}:bucket/{bucket-name}. Required.

--version-token

string

The version token for optimistic locking. You can get the table's current versionToken by using the get-table command to prevent update conflicts during concurrent operations.

Note
  • The rename-table command maps to the RenameTable API. For more information about the API parameters, see RenameTable.

  • For information about the supported global command-line options, see ossutil global options.

Examples

  • Rename a table from old_table to new_table within its current namespace.

    ossutil tables-api rename-table --table-bucket-arn acs:osstables:cn-hangzhou:1234567890:bucket/my-table-bucket --namespace my_namespace --name old_table --new-name new_table
  • Move the table my_table from the my_namespace namespace to target_namespace.

    ossutil tables-api rename-table --table-bucket-arn acs:osstables:cn-hangzhou:1234567890:bucket/my-table-bucket --namespace my_namespace --name my_table --new-namespace target_namespace
  • Rename a table and move it to a different namespace, using a version token for optimistic locking.

    ossutil tables-api rename-table --table-bucket-arn acs:osstables:cn-hangzhou:1234567890:bucket/my-table-bucket --namespace my_namespace --name old_table --new-name new_table --new-namespace target_namespace --version-token abc123def456