Skip to main content

ALTER SHARE

Introduced or updated: v1.2.949
ENTERPRISE EDITION FEATURE
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>' ]
ClauseDescription
ADD ACCOUNTSAdds consumer accounts. The accounts in the list stay.
REMOVE ACCOUNTSRemoves consumer accounts. The other accounts stay.
SET ACCOUNTSReplaces the full list of consumer accounts.
SET CONNECTIONReplaces the connection. The consumers keep access.
SET COMMENTReplaces 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 ACCOUNTS and SET ACCOUNTS require a connection. SET can set the connection in the same statement.
  • SET requires 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';
Try Databend Cloud for FREE

Multimodal, object-storage-native warehouse for BI, vectors, search, and geo.

Snowflake-compatible SQL with automatic scaling.

Sign up and get $200 in credits.

Try it today