-
Notifications
You must be signed in to change notification settings - Fork 477
Add ALTER EXTERNAL CONNECTION #20654
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
9fc21a9
a7e63a7
a610087
88335d9
7c1f1e2
80b3db9
2d08322
601103e
285f772
565bf3d
a71e6a8
9bc3655
e160448
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,82 @@ | ||
| --- | ||
| title: ALTER EXTERNAL CONNECTION | ||
| summary: Use the ALTER EXTERNAL CONNECTION statement to update an external connection's URI. | ||
| toc: true | ||
| docs_area: reference.sql | ||
| --- | ||
|
|
||
| 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. | ||
|
|
||
| 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. | ||
|
|
||
| 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. | ||
|
|
||
| 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](#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. | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. There was a problem hiding this comment. Choose a reason for hiding this commentThe 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}'; | ||
| ~~~ | ||
|
|
||
| ## See also | ||
|
|
||
| - [`CREATE EXTERNAL CONNECTION`]({% link {{ page.version.version }}/create-external-connection.md %}) | ||
| - [`DROP EXTERNAL CONNECTION`]({% link {{ page.version.version }}/drop-external-connection.md %}) | ||
| - [`SHOW CREATE EXTERNAL CONNECTION`]({% link {{ page.version.version }}/show-create-external-connection.md %}) | ||
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.