Skip to content

Commit b0f6ab9

Browse files
Add ALTER EXTERNAL CONNECTION (#20654)
* ALTER EXTERNAL CONNECTION Added a new sql reference page for ALTER EXTERNAL CONNECTION and updated relevant info on other pages * Typo/broken link Typo/broken link * Another typo/broken link Another typo/broken link * Quick changes from review Typos and example variable names * Updated parameters Changed parameter names to match updated diagram * Changes from doc review Changes from doc review- all small
1 parent cb4790b commit b0f6ab9

File tree

4 files changed

+93
-0
lines changed

4 files changed

+93
-0
lines changed

src/current/_includes/v25.4/sidebar-data/sql.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,12 @@
4040
"/${VERSION}/alter-default-privileges.html"
4141
]
4242
},
43+
{
44+
"title": "<code>ALTER EXTERNAL CONNECTION</code>",
45+
"urls": [
46+
"/${VERSION}/alter-external-connection.html"
47+
]
48+
},
4349
{
4450
"title": "<code>ALTER FUNCTION</code>",
4551
"urls": [
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
---
2+
title: ALTER EXTERNAL CONNECTION
3+
summary: Use the ALTER EXTERNAL CONNECTION statement to update an external connection's URI.
4+
toc: true
5+
docs_area: reference.sql
6+
---
7+
8+
The `ALTER EXTERNAL CONNECTION` [statement]({% link {{ page.version.version }}/sql-statements.md %}) allows you to change the [storage/sink](#supported-external-storage-and-sinks) URI that an external connection references.
9+
10+
You can use external connections to specify and interact with resources that are external to CockroachDB. When creating an external connection, you must define a name for the external connection while passing the provider URI and query parameters.
11+
12+
You can use `ALTER EXTERNAL CONNECTION` to update the connection string for an external connection to use a new authentication token. This allows you to rotate your auth token before the old token expires.
13+
14+
You can also use the following SQL statements to work with external connections:
15+
16+
- [`CREATE EXTERNAL CONNECTION`]({% link {{ page.version.version }}/create-external-connection.md %})
17+
- [`SHOW EXTERNAL CONNECTION`]({% link {{ page.version.version }}/show-external-connection.md %})
18+
- [`SHOW CREATE EXTERNAL CONNECTION`]({% link {{ page.version.version }}/show-create-external-connection.md %})
19+
- [`DROP EXTERNAL CONNECTION`]({% link {{ page.version.version }}/drop-external-connection.md %})
20+
21+
## Required privileges
22+
23+
To update an external connection, a user must have the `UPDATE` privilege on that connection.
24+
25+
For example:
26+
27+
{% include_cached copy-clipboard.html %}
28+
~~~sql
29+
GRANT UPDATE ON EXTERNAL CONNECTION backup_bucket TO user;
30+
~~~
31+
32+
## Synopsis
33+
34+
<div>
35+
{% remote_include https://raw.githubusercontent.com/cockroachdb/generated-diagrams/{{ page.release_info.crdb_branch_name }}/grammar_svg/alter_external_connection.html %}
36+
</div>
37+
38+
### Parameters
39+
40+
Parameter | Description
41+
----------+-------------
42+
`connection_name` | The name of the existing external connection.
43+
`connection_uri` | The new [storage/sink](#supported-external-storage-and-sinks) URI that the external connection will be updated to reference.
44+
45+
## Supported external storage and sinks
46+
47+
Storage or sink | Operation support
48+
---------------------+---------------------------------
49+
[Amazon MSK]({% link {{ page.version.version }}/changefeed-sinks.md %}#amazon-msk) | Changefeeds
50+
[Amazon S3]({% link {{ page.version.version }}/use-cloud-storage.md %}) | Backups, restores, imports, exports, changefeeds
51+
[Amazon S3 KMS]({% link {{ page.version.version }}/take-and-restore-encrypted-backups.md %}#aws-kms-uri-format) | Encrypted backups
52+
[Azure Storage]({% link {{ page.version.version }}/use-cloud-storage.md %}) | Backups, restores, imports, exports, changefeeds
53+
[Confluent Cloud]({% link {{ page.version.version }}/changefeed-sinks.md %}#confluent-cloud) | Changefeeds
54+
[Confluent Schema Registry]({% link {{ page.version.version }}/create-changefeed.md %}#confluent-schema-registry) | Changefeeds
55+
[Google Cloud Pub/Sub]({% link {{ page.version.version }}/changefeed-sinks.md %}#google-cloud-pub-sub) | Changefeeds
56+
[Google Cloud Storage]({% link {{ page.version.version }}/use-cloud-storage.md %}) | Backups, restores, imports, exports, changefeeds
57+
[Google Cloud Storage KMS]({% link {{ page.version.version }}/take-and-restore-encrypted-backups.md %}#google-cloud-kms-uri-format) | Encrypted backups
58+
[HTTP(S)]({% link {{ page.version.version }}/changefeed-sinks.md %}) | Changefeeds
59+
[Kafka]({% link {{ page.version.version }}/changefeed-sinks.md %}#kafka) | Changefeeds
60+
[Nodelocal]({% link {{ page.version.version }}/use-cloud-storage.md %}) | Backups, restores, imports, exports, changefeeds
61+
[PostgreSQL]({% link {{ page.version.version }}/set-up-physical-cluster-replication.md %}#connection-reference) connections | Physical cluster replication
62+
[Userfile]({% link {{ page.version.version }}/use-userfile-storage.md %}) | Backups, restores, imports, exports, changefeeds
63+
[Webhook]({% link {{ page.version.version }}/changefeed-sinks.md %}#webhook-sink) | Changefeeds
64+
65+
For more information on authentication and forming the URI that an external connection will represent, refer to the storage or sink pages linked in the table.
66+
67+
## Examples
68+
69+
### Update the URI of an external connection
70+
71+
In this example, you update the `backup_bucket` external connection to a new Amazon S3 URI to rotate your auth token.
72+
73+
{% include_cached copy-clipboard.html %}
74+
~~~sql
75+
ALTER EXTERNAL CONNECTION backup_bucket AS 's3://bucket name?AWS_ACCESS_KEY_ID={new access key}&AWS_SECRET_ACCESS_KEY={new secret access key}';
76+
~~~
77+
78+
## See also
79+
80+
- [`CREATE EXTERNAL CONNECTION`]({% link {{ page.version.version }}/create-external-connection.md %})
81+
- [`DROP EXTERNAL CONNECTION`]({% link {{ page.version.version }}/drop-external-connection.md %})
82+
- [`SHOW CREATE EXTERNAL CONNECTION`]({% link {{ page.version.version }}/show-create-external-connection.md %})

src/current/v25.4/create-external-connection.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,16 @@ You can use external connections to specify and interact with resources that are
99

1010
`CREATE EXTERNAL CONNECTION` will validate the URI by writing, reading, and listing a test file to the external storage URI. If you're using a [KMS URI]({% link {{ page.version.version }}/take-and-restore-encrypted-backups.md %}), `CREATE EXTERNAL CONNECTION` will encrypt and decrypt a file. You'll find a `crdb_external_storage_location` file in your external storage as a result of this test. Each of the operations that access the external connection is aware of the raw URI that is parsed to configure, authenticate, and interact with the connection.
1111

12+
You may need to periodically rotate your authentication token for an external connection before the old token expires. For information on how to update the connection URI to use a new token, consult [`ALTER EXTERNAL CONNECTION`]({% link {{ page.version.version }}/alter-external-connection.md %}).
13+
1214
The [privilege model](#required-privileges) for external connections means that you can delegate the creation and usage of external connections to the necessary users or roles.
1315

1416
You can also use the following SQL statements to work with external connections:
1517

1618
- [`SHOW EXTERNAL CONNECTION`]({% link {{ page.version.version }}/show-external-connection.md %})
1719
- [`SHOW CREATE EXTERNAL CONNECTION`]({% link {{ page.version.version }}/show-create-external-connection.md %})
1820
- [`DROP EXTERNAL CONNECTION`]({% link {{ page.version.version }}/drop-external-connection.md %})
21+
- [`ALTER EXTERNAL CONNECTION`]({% link {{ page.version.version }}/alter-external-connection.md %})
1922

2023
## Required privileges
2124

@@ -187,3 +190,4 @@ In this example, you create an external connection to a Kafka sink to which a ch
187190
- [`IMPORT INTO`]({% link {{ page.version.version }}/import-into.md %})
188191
- [`DROP EXTERNAL CONNECTION`]({% link {{ page.version.version }}/drop-external-connection.md %})
189192
- [`SHOW CREATE EXTERNAL CONNECTION`]({% link {{ page.version.version }}/show-create-external-connection.md %})
193+
- [`ALTER EXTERNAL CONNECTION`]({% link {{ page.version.version }}/alter-external-connection.md %})

src/current/v25.4/sql-statements.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Statement | Usage
1515
----------|------------
1616
[`ALTER DATABASE`]({% link {{ page.version.version }}/alter-database.md %}) | Apply a schema change to a database.
1717
[`ALTER DEFAULT PRIVILEGES`]({% link {{ page.version.version }}/alter-default-privileges.md %}) | Change the default [privileges]({% link {{ page.version.version }}/security-reference/authorization.md %}#privileges) for objects created by specific roles/users in the current database.
18+
[`ALTER EXTERNAL CONNECTION`]({% link {{ page.version.version }}/alter-external-connection.md %}) | Update an external connection's URI.
1819
[`ALTER FUNCTION`]({% link {{ page.version.version }}/alter-function.md %}) | Modify a [user-defined function]({% link {{ page.version.version }}/user-defined-functions.md %}).
1920
[`ALTER INDEX`]({% link {{ page.version.version }}/alter-index.md %}) | Apply a schema change to an index.
2021
[`ALTER PARTITION`]({% link {{ page.version.version }}/alter-partition.md %}) | Configure the replication zone for a partition.

0 commit comments

Comments
 (0)