alterShareAccounts

Manages account access to a Snowflake share by adding, setting, or removing accounts.

Note: This change type does not support automatic rollback or database inspection features (snapshot, diff, diff-changelog, and generate-changelog commands).

Available attributes

Attribute

Type

Description

Required

shareName

String

Name of the share to alter

Yes

ifExists

Boolean

Don't error if the share doesn't exist

No

addAccounts

AccountsOperation

Adds new accounts to the share (nested element)*

No

setAccounts

AccountsOperation

Replaces all accounts with new list (nested element)*

No

removeAccounts

AccountsOperation

Removes specific accounts from the share (nested element)*

No

* Exactly one of addAccounts, setAccounts, or removeAccounts must be specified.

AccountsOperation attributes

Attribute

Type

Description

Required

Applicable to

accounts

List<Account>

List of account identifiers

Yes

All operations

shareRestrictions

Boolean

Enable/disable share restrictions

No

ADD, SET only

Account identifier formats

Snowflake supports multiple account identifier formats:

Format

Example

Legacy account locator

AB12345

Organization.account

MYORG.MYACCOUNT

Account locator with region

xy12345.us-east-1

Full cloud/region format

xy12345.us-east-1.aws

Operation semantics

Operation

Behavior

ADD ACCOUNTS

Adds accounts to existing list (accumulative)

SET ACCOUNTS

Replaces entire account list (destructive)

REMOVE ACCOUNTS

Removes specific accounts from list (selective)

Share restrictions

The `shareRestrictions` parameter controls whether consumer accounts can reshare data:

  • true: Prevents accounts from resharing data to other accounts

  • false: Allows accounts to reshare data (default Snowflake behavior)

  • Only applicable to `ADD ACCOUNTS` and `SET ACCOUNTS` operations

<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog
  xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
  xmlns:pro-snowflake="http://www.liquibase.org/xml/ns/pro-snowflake"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
        http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-latest.xsd
        http://www.liquibase.org/xml/ns/pro-snowflake
        http://www.liquibase.org/xml/ns/pro-snowflake/liquibase-pro-snowflake-latest.xsd">
  <!-- Add accounts -->
  <changeSet id="add-share-accounts" author="examples">
    <pro-snowflake:alterShareAccounts shareName="MY_SHARE">
      <pro-snowflake:addAccounts shareRestrictions="false">
        <pro-snowflake:account name="ORGNAME.ACCOUNT1"/>
        <pro-snowflake:account name="ORGNAME.ACCOUNT2"/>
      </pro-snowflake:addAccounts>
    </pro-snowflake:alterShareAccounts>
  </changeSet>
  <!-- Set accounts (replace all) -->
  <changeSet id="set-share-accounts" author="examples">
    <pro-snowflake:alterShareAccounts shareName="MY_SHARE">
      <pro-snowflake:setAccounts shareRestrictions="true">
        <pro-snowflake:account name="MYORG.NEWACCOUNT1"/>
        <pro-snowflake:account name="MYORG.NEWACCOUNT2"/>
      </pro-snowflake:setAccounts>
    </pro-snowflake:alterShareAccounts>
  </changeSet>
  <!-- Remove accounts -->
  <changeSet id="remove-share-accounts" author="examples">
    <pro-snowflake:alterShareAccounts shareName="MY_SHARE">
      <pro-snowflake:removeAccounts>
        <pro-snowflake:account name="ORGNAME.ACCOUNT1"/>
      </pro-snowflake:removeAccounts>
    </pro-snowflake:alterShareAccounts>
  </changeSet>
  <!-- Add accounts with IF EXISTS -->
  <changeSet id="add-accounts-if-exists" author="examples">
    <pro-snowflake:alterShareAccounts shareName="MY_SHARE" ifExists="true">
      <pro-snowflake:addAccounts>
        <pro-snowflake:account name="ORGNAME.ACCOUNT3"/>
      </pro-snowflake:addAccounts>
    </pro-snowflake:alterShareAccounts>
  </changeSet>
</databaseChangeLog>