ALTER QUERY
Syntax
ALTER QUERY { query_id | query_name[:query_version] }
{ ADD | DROP } TAG tag_key = 'tag_value'
[, { ADD | DROP } TAG tag_key = 'tag_value' ]...;
Description
Modify tags associated with an existing Streaming or Continuous Query.
The ALTER QUERY
statement allows you to add or remove tags from a query. Tags are key-value pairs that can be used for metadata, organization, and filtering purposes.
Queries can only be modified by a Role with appropriate privileges on the query.
Arguments
query_id
Specifies the unique identifier (UUID) of the query to modify. You can find query IDs using the LIST QUERIES command.
query_name
Specifies the name of the query to modify. For case-sensitive names, the name must be wrapped in double quotes, otherwise, the lowercased name will be used.
query_version
Specifies the version of the query when using query_name
. If not provided, the latest version is used.
tag_key
Specifies the key name for the tag. Tag keys are string values that identify the tag.
tag_value
Specifies the value for the tag. Tag values are string values associated with the tag key.
Tag Operations
ADD TAG
ADD TAG
Adds a new tag to the query with the specified key-value pair. If a tag with the same key already exists, it will be updated with the new value.
DROP TAG
DROP TAG
Removes the tag with the specified key from the query. The tag value must still be specified in the syntax but is ignored during the operation.
Examples
Add tags to a query
Add multiple tags to a query using its ID:
ALTER QUERY 142ecf31-bc8d-496b-bd0b-28ebb4a8757e
ADD TAG 'environment' = 'production',
ADD TAG 'team' = 'analytics',
ADD TAG 'cost-center' = 'engineering';
Add a tag to a query using query name
Add a tag to a query using its name and version:
ALTER QUERY my_analytics_query:2
ADD TAG 'priority' = 'high';
Remove tags from a query
Remove specific tags from a query:
ALTER QUERY my_analytics_query
DROP TAG 'environment' = 'staging',
DROP TAG 'deprecated' = 'true';
Mix add and drop operations
Add some tags while removing others in a single statement:
ALTER QUERY 142ecf31-bc8d-496b-bd0b-28ebb4a8757e
ADD TAG 'environment' = 'production',
DROP TAG 'environment' = 'staging',
ADD TAG 'updated_by' = 'admin';
Related Commands
LIST QUERIES - List all queries to find query IDs and names
DESCRIBE QUERY - View query details including current tags
CREATE TABLE AS - Create streaming queries
CREATE MATERIALIZED VIEW AS - Create materialized view queries
Last updated