createShare

Creates a new share in Snowflake. Shares are used to securely share data between Snowflake accounts.

Note: Automatic rollback drops the share.

Known limitation: This change type does not support database inspection features (snapshot, diff, diff-changelog, and generate-changelog commands).

Available attributes

Attribute

Type

Description

Required

shareName

String

Name of the share to create

Yes

replaceIfExists

Boolean

Replace the share if it exists using OR REPLACE*

No

ifNotExists

Boolean

Only create if the share doesn't exist using IF NOT EXISTS*

No

comment

String

Comment describing the share

No

* replaceIfExists and ifNotExists are mutually exclusive.

<?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">
  <!-- Simple share -->
  <changeSet id="create-simple-share" author="examples">
    <pro-snowflake:createShare shareName="MY_DATA_SHARE"/>
  </changeSet>
  <!-- Share with comment -->
  <changeSet id="create-share-with-comment" author="examples">
    <pro-snowflake:createShare
                shareName="ANALYTICS_SHARE"
                comment="Share for analytics team"/>
  </changeSet>
  <!-- Share with OR REPLACE -->
  <changeSet id="create-share-or-replace" author="examples">
    <pro-snowflake:createShare
                shareName="REPORTS_SHARE"
                replaceIfExists="true"
                comment="Reports share with OR REPLACE"/>
  </changeSet>
  <!-- Share with IF NOT EXISTS -->
  <changeSet id="create-share-if-not-exists" author="examples">
    <pro-snowflake:createShare
                shareName="PARTNER_SHARE"
                ifNotExists="true"
                comment="Partner share with IF NOT EXISTS"/>
  </changeSet>
</databaseChangeLog>