Skip to content
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/current/_includes/v25.4/sidebar-data/sql.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@
"/${VERSION}/alter-default-privileges.html"
]
},
{
"title": "<code>ALTER EXTERNAL CONNECTION</code>",
"urls": [
"/${VERSION}/alter-external-connection.html"
]
},
{
"title": "<code>ALTER FUNCTION</code>",
"urls": [
Expand Down
74 changes: 74 additions & 0 deletions src/current/v25.4/alter-external-connection.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
---
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something strange is happening in the sidebar on this page, and I'm not sure why. When I go to http://localhost:4000/docs/v25.4/alter-external-connection I see "ALTER EXTERNAL CONNECTION" in the sidebar, but then when I click a different page in that section (for example, "ALTER BACKUP") the "ALTER EXTERNAL CONNECTION link in the sidebar disappears. But randomly it'll appear again if you specifically navigate to the "ALTER DATABASE" page? I'm not sure why. I haven't tested all of the pages, so I'm not sure when/why it re-appears, but this link should never disappear.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this is just a weird anomaly with local builds. If you look at the preview build linked above, it doesn't have this same bug.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh strange, yeah you're right about that.

title: ALTER EXTERNAL CONNECTION
summary: Use the ALTER EXTERNAL CONNECTION statement to update an external connection's URI.
toc: true
docs_area: reference.sql
---

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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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.
You can use external connections to specify and interact with resources that are external to CockroachDB. When creating an external connection, you can 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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All of the other pages in this section begin like this "The ALTER EXTERNAL CONNECTION statement..." so for the sake of consistency I'd recommend following suit.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the "Supported external storage and sinks" table on this page is identical to the table on the "Create External Connection" page that you're linking to, I'd link instead to the table below, for the sake of keeping the reader on this page.


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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sentence is long and confusing but I don't know enough about this functionality to recommend a specific change.


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

- [`CREATE EXTERNAL CONNECTION`]({% link {{ page.version.version }}/create-external-connection.md %})
- [`SHOW EXTERNAL CONNECTION`]({% link {{ page.version.version }}/show-external-connection.md %})
- [`SHOW CREATE EXTERNAL CONNECTION`]({% link {{ page.version.version }}/show-create-external-connection.md %})
- [`DROP EXTERNAL CONNECTION`]({% link {{ page.version.version }}/drop-external-connection.md %})

## Required privileges

To update an external connection, a user must have the `UPDATE` privilege on that connection.

For example:

{% include_cached copy-clipboard.html %}
~~~sql
GRANT UPDATE ON EXTERNAL CONNECTION backup_bucket TO user;
~~~

## Synopsis

<div>
{% remote_include https://raw.githubusercontent.com/cockroachdb/generated-diagrams/{{ page.release_info.crdb_branch_name }}/grammar_svg/alter_external_connection.html %}
</div>

### Parameters

Parameter | Description
----------+-------------
`connection_name` | The name of the existing external connection.
`connection_uri` | 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.

## Supported external storage and sinks

Storage or sink | Operation support
---------------------+---------------------------------
[Amazon MSK]({% link {{ page.version.version }}/changefeed-sinks.md %}#amazon-msk) | Changefeeds
[Amazon S3]({% link {{ page.version.version }}/use-cloud-storage.md %}) | Backups, restores, imports, exports, changefeeds
[Amazon S3 KMS]({% link {{ page.version.version }}/take-and-restore-encrypted-backups.md %}#aws-kms-uri-format) | Encrypted backups
[Azure Storage]({% link {{ page.version.version }}/use-cloud-storage.md %}) | Backups, restores, imports, exports, changefeeds
[Confluent Cloud]({% link {{ page.version.version }}/changefeed-sinks.md %}#confluent-cloud) | Changefeeds
[Confluent Schema Registry]({% link {{ page.version.version }}/create-changefeed.md %}#confluent-schema-registry) | Changefeeds
[Google Cloud Pub/Sub]({% link {{ page.version.version }}/changefeed-sinks.md %}#google-cloud-pub-sub) | Changefeeds
[Google Cloud Storage]({% link {{ page.version.version }}/use-cloud-storage.md %}) | Backups, restores, imports, exports, changefeeds
[Google Cloud Storage KMS]({% link {{ page.version.version }}/take-and-restore-encrypted-backups.md %}#google-cloud-kms-uri-format) | Encrypted backups
[HTTP(S)]({% link {{ page.version.version }}/changefeed-sinks.md %}) | Changefeeds
[Kafka]({% link {{ page.version.version }}/changefeed-sinks.md %}#kafka) | Changefeeds
[Nodelocal]({% link {{ page.version.version }}/use-cloud-storage.md %}) | Backups, restores, imports, exports, changefeeds
[PostgreSQL]({% link {{ page.version.version }}/set-up-physical-cluster-replication.md %}#connection-reference) connections | Physical cluster replication
[Userfile]({% link {{ page.version.version }}/use-userfile-storage.md %}) | Backups, restores, imports, exports, changefeeds
[Webhook]({% link {{ page.version.version }}/changefeed-sinks.md %}#webhook-sink) | Changefeeds

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.

## Examples

### Update the URI of an external connection

In this example, you update the `backup_bucket` external connection to a new Amazon S3 URI to rotate your auth token.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most of the pages in this section use the following template to explain Examples: "To [desired effect], [thing you should do]". I'd recommend following that template, as it'll allow you to avoid an awkward usage of the second person.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that it's an awkward usage of the second person here, but it follows a precedent set in CREATE EXTERNAL CONNECTION , which is the most closely related page to this one. This page is effectively a continuation of that one for anyone actually using external connections, so I think it's best to leave it this way to maintain consistency over the two pages.


{% include_cached copy-clipboard.html %}
~~~sql
ALTER EXTERNAL CONNECTION backup_bucket AS 's3://bucket name?AWS_ACCESS_KEY_ID={new access key}&AWS_SECRET_ACCESS_KEY={new secret access key}';
~~~
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most pages in this section end with a "See also" header. I'd recommend following suit for consistency's sake.

3 changes: 3 additions & 0 deletions src/current/v25.4/create-external-connection.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,16 @@ You can use external connections to specify and interact with resources that are

`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.

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 %}).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment as above.


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.

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

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

## Required privileges

Expand Down
1 change: 1 addition & 0 deletions src/current/v25.4/sql-statements.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Statement | Usage
----------|------------
[`ALTER DATABASE`]({% link {{ page.version.version }}/alter-database.md %}) | Apply a schema change to a database.
[`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.
[`ALTER EXTERNAL CONNECTION`]({% link {{ page.version.version }}/alter-external-connection.md %}) | Update an external connection's URI.
[`ALTER FUNCTION`]({% link {{ page.version.version }}/alter-function.md %}) | Modify a [user-defined function]({% link {{ page.version.version }}/user-defined-functions.md %}).
[`ALTER INDEX`]({% link {{ page.version.version }}/alter-index.md %}) | Apply a schema change to an index.
[`ALTER PARTITION`]({% link {{ page.version.version }}/alter-partition.md %}) | Configure the replication zone for a partition.
Expand Down
Loading