Version:

alter_tableΒΆ

GPUdb.alter_table( table_name = None, action = None, value = None, options = {}
                   )

Apply various modifications to a table or collection. Available modifications include:

Creating or deleting an index on a particular column. This can speed up certain search queries (such as get_records, delete_records, update_records) when using expressions containing equality or relational operators on indexed columns. This only applies to child tables.

Making a table protected or not. Protected tables need the admin password to be sent in a clear_table to delete the table. This can be applied to child tables or collections or views.

Setting the time-to-live (TTL). This can be applied to tables, views, or collections. When applied to collections, every table & view within the collection will have its TTL set to the given value.

Allowing homogeneous child tables. This only applies to collections.

Input Parameter Description

Name Type Description
table_name str Table on which the operation will be performed. Must be a valid table or collection in GPUdb.
action str

Modification operation to be applied to the table or collection

Supported Values Description
create_index Creates an index on the column name specified in input parameter value. If this column is already indexed, GPUdb will return an error.
delete_index Deletes an existing index on the column name specified in input parameter value. If this column does not have indexing turned on, GPUdb will return an error.
allow_homogeneous_tables Sets whether homogeneous child tables are allowed in the given collection. This action is only valid if input parameter table_name is a collection. input parameter value must be either 'true' or 'false'.
protected Sets whether the given input parameter table_name should be protected or not. input parameter value must be either 'true' or 'false'.
ttl Sets the time-to-live (TTL) of the table, view, or collection specified in input parameter table_name. input parameter value must be the desired TTL in minutes.
value str The value of the modification. May be a column name, 'true' or 'false', or a time-to-live depending on input parameter action.
options dict of str Optional parameters. Default value is an empty dict ( {} ).

Output Parameter Description

Name Type Description
table_name str Table on which the operation was performed.
action str Modification operation that was performed.
value str The value of the modification that was performed.