ALTER SHARE
Introduced or updated: v1.2.949
Data Sharing is an Enterprise Edition feature. Contact Databend Support for a license.
Changes the consumer accounts, the connection, or the comment of a Share.
Syntax
ALTER SHARE [ IF EXISTS ] <share_name>
ADD ACCOUNTS = <tenant_id> [, <tenant_id> ... ]
ALTER SHARE [ IF EXISTS ] <share_name>
REMOVE ACCOUNTS = <tenant_id> [, <tenant_id> ... ]
ALTER SHARE [ IF EXISTS ] <share_name> SET
[ ACCOUNTS = <tenant_id> [, <tenant_id> ... ] ]
[ CONNECTION = <connection_name> ]
[ COMMENT = '<comment>' ]
| Clause | Description |
|---|---|
ADD ACCOUNTS | Adds consumer accounts. The accounts in the list stay. |
REMOVE ACCOUNTS | Removes consumer accounts. The other accounts stay. |
SET ACCOUNTS | Replaces the full list of consumer accounts. |
SET CONNECTION | Replaces the connection. The consumers keep access. |
SET COMMENT | Replaces the comment. |
Usage Notes
- A tenant ID is not a user name or a role name. To get a tenant ID, use CURRENT_TENANT_ID.
- If a tenant ID contains uppercase letters or special characters, put the ID in backticks.
ADD ACCOUNTSandSET ACCOUNTSrequire a connection.SETcan set the connection in the same statement.SETrequires one or more properties.- Databend examines a new connection for all granted tables. If the examination fails, the Share keeps the old connection.
caution
SET ACCOUNTS replaces the full list. The accounts that are not in the statement lose access.
For the privileges, see Access Control. For the procedures, see Manage Shares.
Examples
ALTER SHARE sales_share ADD ACCOUNTS = consumer_acct, `consumer-tenant`;
ALTER SHARE sales_share REMOVE ACCOUNTS = `consumer-tenant`;
ALTER SHARE sales_share SET ACCOUNTS = consumer_acct;
ALTER SHARE sales_share SET CONNECTION = replacement_conn;
ALTER SHARE sales_share SET COMMENT = 'Updated description';