URL: http://GPUDB_IP_ADDRESS:GPUDB_PORT/alter/table
Apply various modifications to a table, view, or collection. The available modifications include the following:
Manage a table's columns--a column can be added, removed, or have its type and properties modified, including whether it is compressed or not.
Create or delete an index on a particular column. This can speed up certain operations when using expressions containing equality or relational operators on indexed columns. This only applies to tables.
Create or delete a foreign key on a particular column.
Manage a range-partitioned or a manual list-partitioned table's partitions.
Set (or reset) the tier strategy of a table or view.
Refresh and manage the refresh mode of a materialized view.
Set the time-to-live (TTL). This can be applied to tables, views, or collections. When applied to collections, every contained table & view that is not protected will have its TTL set to the given value.
Set the global access mode (i.e. locking) for a table. This setting trumps any role-based access controls that may be in place; e.g., a user with write access to a table marked read-only will not be able to insert records into it. The mode can be set to read-only, write-only, read/write, and no access.
Change the protection mode to prevent or allow automatic expiration. This can be applied to tables, views, and collections.
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
|
||||||||||||||||||||||||||||||||||||||||||||||||
value | string | The value of the modification, depending on input parameter action. For example, if input parameter action is add_column, this would be the column name; while the column's definition would be covered by the column_type, column_properties, column_default_value, and add_column_expression in input parameter options. If input parameter action is ttl, it would be the number of minutes for the new TTL. If input parameter action is refresh, this field would be blank. | ||||||||||||||||||||||||||||||||||||||||||||||||
options | map of string to strings | Optional parameters. The default value is an empty map ( {} ).
|
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:
Empty string in case of an error. |