A set of parameters for GPUdb::alterTable. More…
#include <gpudb/protocol/alter_table.h>
Public Member Functions | |
| AlterTableRequest () | |
| Constructs an AlterTableRequest object with default parameters. | |
| AlterTableRequest (const std::string &tableName_, const std::string &action_, const std::string &value_, const std::map< std::string, std::string > &options_) | |
| Constructs an AlterTableRequest object with the specified parameters. | |
Public Attributes | |
| std::string | tableName |
| Table on which the operation will be performed, in [ schema_name. | |
| std::string | action |
| Modification operation to be applied. | |
| std::string | value |
| The value of the modification, depending on action. | |
| std::map< std::string, std::string > | options |
| Optional parameters. | |
Detailed Description
A set of parameters for GPUdb::alterTable.
Apply various modifications to a table or view. 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 dictionary encoded or not.
External tables cannot be modified except for their refresh method.
Create or delete a column, low-cardinality index, chunk skip, geospatial, CAGRA, or HNSW index. 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 or an external table.
Set the time-to-live (TTL). This can be applied to tables or views.
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.
Definition at line 64 of file alter_table.h.
Constructor & Destructor Documentation
◆ AlterTableRequest() [1/2]
| inline |
Constructs an AlterTableRequest object with default parameters.
Definition at line 69 of file alter_table.h.
◆ AlterTableRequest() [2/2]
| inline |
Constructs an AlterTableRequest object with the specified parameters.
| [in] | tableName_ | Table on which the operation will be performed, in [schema_name.]table_name format, using standard name resolution rules. Must be an existing table or view. |
| [in] | action_ | Modification operation to be applied. Supported values:
|
| [in] | value_ | The value of the modification, depending on action_. For example, if 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 options_. If action_ is ttl, it would be the number of minutes for the new TTL. If action_ is refresh, this field would be blank. |
| [in] | options_ | Optional parameters.
|
Definition at line 647 of file alter_table.h.
Member Data Documentation
◆ action
| std::string gpudb::AlterTableRequest::action |
Modification operation to be applied.
Supported values:
- alter_table_create_index: Creates a column (attribute) index, low-cardinality index, chunk skip index, geospatial index, CAGRA index, or HNSW index (depending on the specified index_type), on the column name specified in value. If this column already has the specified index, an error will be returned.
- alter_table_refresh_index: Refreshes an index identified by index_type, on the column name specified in value. Currently applicable only to CAGRA indices.
- alter_table_delete_index: Deletes a column (attribute) index, low-cardinality index, chunk skip index, geospatial index, CAGRA index, or HNSW index (depending on the specified index_type), on the column name specified in value. If this column does not have the specified index, an error will be returned.
- alter_table_move_to_collection: [DEPRECATED–please use move_to_schema and use GPUdb::createSchema to create the schema if non-existent] Moves a table or view into a schema named value. If the schema provided is non-existent, it will be automatically created.
- alter_table_move_to_schema: Moves a table or view into a schema named value. If the schema provided is nonexistent, an error will be thrown. If value is empty, then the table or view will be placed in the user’s default schema.
- alter_table_protected: No longer used. Previously set whether the given tableName should be protected or not. The value would have been either ‘true’ or ‘false’.
- alter_table_rename_table: Renames a table or view to value. Has the same naming restrictions as tables.
- alter_table_ttl: Sets the time-to-live in minutes of the table or view specified in tableName.
- alter_table_add_comment: Adds the comment specified in value to the table specified in tableName. Use column_name to set the comment for a column.
- alter_table_add_column: Adds the column specified in value to the table specified in tableName. Use column_type and column_properties in options to set the column’s type and properties, respectively.
- alter_table_change_column: Changes type and properties of the column specified in value. Use column_type and column_properties in options to set the column’s type and properties, respectively. Note that primary key and/or shard key columns cannot be changed. All unchanging column properties must be listed for the change to take place, e.g., to add dictionary encoding to an existing ‘char4’ column, both ‘char4’ and ‘dict’ must be specified in the options map.
- alter_table_delete_column: Deletes the column specified in value from the table specified in tableName.
- alter_table_set_default: Sets or replaces the default value expression for the column specified in value. The new default is taken from add_column_expression. Existing properties on the column are preserved.
- alter_table_delete_default: Removes the default value expression from the column specified in value. Other column properties are preserved.
- alter_table_create_foreign_key: Creates a foreign key specified in value using the format ‘(source_column_name [, …]) references target_table_name(primary_key_column_name [, …]) [as foreign_key_name]’.
- alter_table_delete_foreign_key: Deletes a foreign key. The value should be the foreign_key_name specified when creating the key or the complete string used to define it.
- alter_table_add_partition: Adds the partition specified in value, to either a range-partitioned or manual list-partitioned table.
- alter_table_remove_partition: Removes the partition specified in value (and relocates all of its data to the default partition) from either a range-partitioned or manual list-partitioned table.
- alter_table_delete_partition: Deletes the partition specified in value (and all of its data) from either a range-partitioned or manual list-partitioned table.
- alter_table_set_global_access_mode: Sets the global access mode (i.e. locking) for the table specified in tableName. Specify the access mode in value. Valid modes are ‘no_access’, ‘read_only’, ‘write_only’ and ‘read_write’.
- alter_table_refresh: For a materialized view, replays all the table creation commands required to create the view. For an external table, reloads all data in the table from its associated source files or data source.
- alter_table_set_refresh_method: For a materialized view, sets the method by which the view is refreshed to the method specified in value - one of ‘manual’, ‘periodic’, or ‘on_change’. For an external table, sets the method by which the table is refreshed to the method specified in value
- either ‘manual’ or ‘on_start’.
- alter_table_set_refresh_start_time: Sets the time to start periodic refreshes of this materialized view to the datetime string specified in value with format ‘YYYY-MM-DD HH:MM:SS’. Subsequent refreshes occur at the specified time + N * the refresh period.
- alter_table_set_refresh_stop_time: Sets the time to stop periodic refreshes of this materialized view to the datetime string specified in value with format ‘YYYY-MM-DD HH:MM:SS’.
- alter_table_set_refresh_period: Sets the time interval in seconds at which to refresh this materialized view to the value specified in value. Also, sets the refresh method to periodic if not already set.
- alter_table_set_refresh_span: Sets the future time-offset(in seconds) for the view refresh to stop.
- alter_table_set_refresh_execute_as: Sets the user name to refresh this materialized view to the value specified in value.
- alter_table_remove_text_search_attributes: Removes text search attribute from all columns.
- alter_table_remove_shard_keys: Removes the shard key property from all columns, so that the table will be considered randomly sharded. The data is not moved. The value is ignored.
- alter_table_set_strategy_definition: Sets the tier strategy for the table and its columns to the one specified in value, replacing the existing tier strategy in its entirety.
- alter_table_cancel_datasource_subscription: Permanently unsubscribe a data source that is loading continuously as a stream. The data source can be Kafka / S3 / Azure / GCS.
- alter_table_drop_datasource_subscription: Permanently delete a cancelled data source subscription.
- alter_table_pause_datasource_subscription: Temporarily unsubscribe a data source that is loading continuously as a stream. The data source can be Kafka / S3 / Azure / GCS.
- alter_table_resume_datasource_subscription: Resubscribe to a paused data source subscription. The data source can be Kafka / S3 / Azure / GCS.
- alter_table_change_owner: Change the owner resource group of the table.
- alter_table_set_load_vectors_policy: Set startup data loading scheme for the table; see description of ‘load_vectors_policy’ in GPUdb::createTable for possible values for value.
- alter_table_set_build_pk_index_policy: Set startup primary key generation scheme for the table; see description of ‘build_pk_index_policy’ in GPUdb::createTable for possible values for value.
- alter_table_set_build_materialized_view_policy: Set startup rebuilding scheme for the materialized view; see description of ‘build_materialized_view_policy’ in GPUdb::createMaterializedView for possible values for value.
Definition at line 913 of file alter_table.h.
◆ options
| std::map<std::string, std::string> gpudb::AlterTableRequest::options |
Optional parameters.
- alter_table_action
- alter_table_column_name
- alter_table_table_name
- alter_table_column_default_value: When adding a column, set a literal default value for existing records. For nullable columns, the default value will be null, regardless of data type. Also persisted as the column’s default for future inserts that omit the column.
- alter_table_column_properties: When adding or changing a column, set the column properties (strings, separated by a comma: data, text_search, char8, int8 etc).
- alter_table_column_type: When adding or changing a column, set the column type (strings, separated by a comma: int, double, string, null etc).
- alter_table_copy_values_from_column: [DEPRECATED] Please use add_column_expression instead.
- alter_table_rename_column: When changing a column, specify new column name.
- alter_table_validate_change_column: When changing a column, validate the change before applying it (or not). Supported values:
- alter_table_true: Validate all values. A value too large (or too long) for the new type will prevent any change.
- alter_table_false: When a value is too large or long, it will be truncated.
- alter_table_update_last_access_time: Indicates whether the time-to-live (TTL) expiration countdown timer should be reset to the table’s TTL. Supported values:
- alter_table_true: Reset the expiration countdown timer to the table’s configured TTL.
- alter_table_false: Don’t reset the timer; expiration countdown will continue from where it is, as if the table had not been accessed.
- alter_table_add_column_expression: When adding a column or setting a new default with action set to set_default, the new default expression (GPUdb-syntax) for the column. Any valid expression may be used, including one containing references to existing columns in the same table. Persisted as the column’s default for future inserts that omit the column; for add_column, also used to backfill existing rows.
- alter_table_add_column_expression_sql: Optional SQL-syntax form of add_column_expression, used only when the SQL syntax differs from the GPUdb syntax. Persisted alongside the GPUdb form so SHOW CREATE TABLE / information_schema can reproduce the original SQL.
- alter_table_strategy_definition: Parameter for specifying the tier strategy for the table and its columns when action is set_strategy_definition, replacing the existing tier strategy in its entirety.
- alter_table_index_type: Type of index to create, when action is create_index; to refresh, when action is refresh_index; or to delete, when action is delete_index. Supported values:
- alter_table_column: Create or delete a column (attribute) index.
- alter_table_low_cardinality: Create a low-cardinality column (attribute) index.
- alter_table_chunk_skip: Create or delete a chunk skip index.
- alter_table_geospatial: Create or delete a geospatial index.
- alter_table_cagra: Create or delete a CAGRA index on a vector column.
- alter_table_hnsw: Create or delete an HNSW index on a vector column.
- alter_table_index_options: Options to use when creating an index, in the format “key: value [, key: value [, …]]”. Valid options vary by index type.
The default value is an empty map.
Definition at line 1061 of file alter_table.h.
◆ tableName
| std::string gpudb::AlterTableRequest::tableName |
Table on which the operation will be performed, in [ schema_name.
\ ]table_name format, using standard name resolution rules. Must be an existing table or view.
Definition at line 662 of file alter_table.h.
◆ value
| std::string gpudb::AlterTableRequest::value |
The value of the modification, depending on action.
For example, if 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 options. If action is ttl, it would be the number of minutes for the new TTL. If action is refresh, this field would be blank.
Definition at line 929 of file alter_table.h.
The documentation for this struct was generated from the following file:
- gpudb/protocol/alter_table.h