ALTER LINK
On this page
The ALTER LINK command modifies an existing connection link.
This command modifies an existing link in place by updating its configuration and/or credentials clause, without recreating the link or dependent objects such as pipelines or external functions.
Syntax
ALTER LINK [database.]link_name
<set_clause> [<set_clause>]
<set_clause>:
SET CONFIG 'configuration_json'
| SET CONFIG ::config_key = 'value'
| SET CREDENTIALS 'credentials_json'
| SET CREDENTIALS ::credential_key = 'value'Note
Each ALTER LINK query can contain at most two SET clauses, provided that one is SET CONFIG and the other is SET CREDENTIALS.
Arguments
-
database: Name of the database that contains the link. -
link_: Name of the existing link to modify.name -
SET CONFIG 'configuration_: Specifies the link configuration in JSON format.json' The specified configuration replaces the existing CONFIGclause. -
SET CONFIG ::config_: Updates or adds a single top-level configuration parameter (key) in the configuration JSON.key = 'value' If the parameter exists, it is updated; otherwise, a new parameter is added to the configuration. -
SET CREDENTIALS 'credentials_: Specifies the link credentials in JSON format.json' The specified credentials replace the existing CREDENTIALSclause. -
SET CREDENTIALS ::credential_: Updates or adds a single top-level credential parameter (key) in the credentials JSON.key = 'value' If the parameter exists, it is updated; otherwise, a new parameter is added to the credentials JSON.
Remarks
-
An empty JSON object, such as
CONFIG '{}', clears the existing configuration. -
Refer to Permissions Matrix for the required permissions.
-
If a pipeline that uses the link is currently running, it must be paused or stopped before running the
ALTER LINKcommand.Otherwise, the ALTER LINKcommand will return an error. -
After successfully running an
ALTER LINKcommand, theSHOW CREATE LINKcommand returns the updated link definition.
Examples
The examples use the following link:
CREATE LINK analytics_link AS S3CONFIG '{"disable_gunzip":false}'CREDENTIALS '{"aws_access_key_id":"initial_key_id","aws_secret_access_key":"initial_secret"}';
Note: The output is formatted for readability.
-
Add a configuration parameter:
ALTER LINK analytics_linkSET CONFIG ::region = "us-east-1";SHOW CREATE LINK analytics_link \GLink Name: analytics_link Create Link: CREATE LINK `analytics_link` AS S3 CONFIG "{\"disable_gunzip\":false,\"region\":\"us-east-1\"}" CREDENTIALS <CREDENTIALS REDACTED> -
Modify a single configuration parameter:
ALTER LINK analytics_linkSET CONFIG ::region = 'us-west-2';SHOW CREATE LINK analytics_link \GLink Name: analytics_link Create Link: CREATE LINK `analytics_link` AS S3 CONFIG "{\"disable_gunzip\":false,\"region\":\"us-west-2\"}" CREDENTIALS <CREDENTIALS REDACTED> -
Replace the
CONFIGJSON:ALTER LINK analytics_linkSET CONFIG '{"region":"eu-central-1","disable_gunzip":true}';SHOW CREATE LINK analytics_link \GLink Name: analytics_link Create Link: CREATE LINK `analytics_link` AS S3 CONFIG "{\"region\":\"eu-central-1\",\"disable_gunzip\":true}" CREDENTIALS <CREDENTIALS REDACTED> -
Modify a single credential parameter:
ALTER LINK analytics_linkSET CREDENTIALS ::aws_access_key_id = 'rotated_key_id';SHOW CREATE LINK analytics_link \GLink Name: analytics_link Create Link: CREATE LINK `analytics_link` AS S3 CONFIG "{\"region\":\"eu-central-1\",\"disable_gunzip\":true}" CREDENTIALS <CREDENTIALS REDACTED> -
Replace the
CREDENTIALSJSON:ALTER LINK analytics_linkSET CREDENTIALS '{"aws_access_key_id":"final_key_id","aws_secret_access_key":"final_secret"}';SHOW CREATE LINK analytics_link \GLink Name: analytics_link Create Link: CREATE LINK `analytics_link` AS S3 CONFIG "{\"region\":\"eu-central-1\",\"disable_gunzip\":true}" CREDENTIALS <CREDENTIALS REDACTED> -
Modify the
CONFIGandCREDENTIALJSON in the sameALTER LINKquery:ALTER LINK analytics_linkSET CONFIG '{"region":"eu-central-1","disable_gunzip":true}'SET CREDENTIALS '{"aws_access_key_id":"final_key_id","aws_secret_access_key":"final_secret"}';SHOW CREATE LINK analytics_link \GLink Name: analytics_link Create Link: CREATE LINK `analytics_link` AS S3 CONFIG "{\"region\":\"eu-central-1\",\"disable_gunzip\":true}" CREDENTIALS <CREDENTIALS REDACTED>-- Using a combination of JSON and single-key updatesALTER LINK analytics_linkSET CONFIG '{"region":"us-west-2","disable_gunzip":true}'SET CREDENTIALS ::aws_access_key_id = 'rotated_key_id';SHOW CREATE LINK analytics_link \GLink Name: analytics_link Create Link: CREATE LINK `analytics_link` AS S3 CONFIG "{\"disable_gunzip\":true,\"region\":\"us-west-2\"}" CREDENTIALS <CREDENTIALS REDACTED>
Related Topics
Last modified: