/alter/table
URL: http://GPUDB_IP_ADDRESS:GPUDB_PORT/alter/table
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 tables.
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.
Making a table protected or not. Protected tables have their TTLs set to not automatically expire. This can be applied to tables, views, and collections.
Allowing homogeneous tables within a collection.
Managing a table's columns--a column can be added or removed, or have its type modified.
Name |
Type |
Description |
table_name |
string |
Table on which the operation will be performed. Must be an existing table, view, or collection. |
action |
string |
Modification operation to be applied
Supported Values |
Description |
create_index |
Creates an index on the column name specified in input parameter value. If this column is already indexed, an error will be returned. |
delete_index |
Deletes an existing index on the column name specified in input parameter value. If this column does not have indexing turned on, an error will be returned. |
allow_homogeneous_tables |
Sets whether homogeneous tables are allowed in the given collection. This action is only valid if input parameter table_name is a collection. The input parameter value must be either 'true' or 'false'. |
protected |
Sets whether the given input parameter table_name should be protected or not. The input parameter value must be either 'true' or 'false'. |
ttl |
Sets the TTL of the table, view, or collection specified in input parameter table_name. The input parameter value must be the desired TTL in minutes. |
add_column |
Add a column input parameter value to the table. set the column properties in options |
delete_column |
Delete a column input parameter value from the table |
change_column |
Change properties of a column input parameter value in the table. set the column properties in options |
rename_table |
Rename a table, view or collection to input parameter value. Has the same naming restrictions as tables. |
|
value |
string |
The value of the modification. May be a column name, 'true' or 'false', or a TTL depending on input parameter action. |
options |
map of
strings |
Optional parameters. Default value is an empty map ( {} ).
Supported Parameters
(keys) |
Parameter Description |
column_default_value |
when adding a column: set a default value, for existing data. |
column_properties |
when adding or changing a column: set the column properties (strings, separated by a comma: data, store_only, text_search, char8, int8 etc). |
column_type |
when adding or changing a column: set the column type (strings, separated by a comma: int, double, string, null etc). |
validate_change_column |
Validate the type change before applying column_change request. Default is true (if option is missing). If true, then validate all values. A value too large (or too long) for the new type will prevent any change. If false, then when a value is too large or long, it will be truncated. Default value is 'true'.
Supported
Values |
Description |
true |
true |
false |
false |
|
copy_values_from_column |
when adding or changing a column: enter column name - from where to copy values. |
|
The GPUdb server embeds the endpoint response inside a standard response structure which contains status information and the actual response to the query. Here is a description of the various fields of the wrapper:
Name |
Type |
Description |
status |
String |
'OK' or 'ERROR' |
message |
String |
Empty if success or an error message |
data_type |
String |
'alter_table_request' or 'none' in case of an
error |
data |
String |
Empty string |
data_str |
JSON
or
String |
This embedded JSON represents the result of the
/alter/table endpoint:
Name |
Type |
Description |
table_name |
string |
Table on which the
operation was performed. |
action |
string |
Modification operation that
was performed. |
value |
string |
The value of the
modification that was
performed. |
Empty string in case of an error.
|