Skip to content

Commit 9fc21a9

Browse files
ALTER EXTERNAL CONNECTION
Added a new sql reference page for ALTER EXTERNAL CONNECTION and updated relevant info on other pages
1 parent 2ee94b6 commit 9fc21a9

File tree

4 files changed

+84
-0
lines changed

4 files changed

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

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

Lines changed: 3 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 by updating the URI for the connection to use a new auth token before the old auth token expires. For information on how to do this, 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

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 conection'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)