This topic describes how to configure the specifications of a Snowflake Native App
to request permission to share data with providers or third parties through
listings. This enables use cases such as compliance reporting, telemetry
sharing, and data preprocessing.
Share data from an app with providers or third parties¶
Some Snowflake Native Apps need to share data back with the provider or with third-party Snowflake accounts for
various business purposes. Common use cases include the following:
Compliance reporting: Sharing audit logs or compliance data with regulatory accounts
Telemetry and analytics: Sending usage metrics back to the provider for product improvement
Data preprocessing: Sharing transformed data with partner accounts
Support and troubleshooting: Providing diagnostic data to support teams
To enable data sharing from an app, the app needs to provide both shares and
listings. A share contains the database objects to be shared, and a listing
provides the mechanism to share data across accounts and regions.
To request permission from the consumer to share data with specific target
accounts, use application specifications.
Note
Unlike other app specification types, each LISTING specification is associated with exactly one
listing object. An app cannot create multiple app specifications for the same listing.
The setup script creates the share and listing when the app is installed or
upgraded. The app specification can be created during setup or at runtime
through a stored procedure.
When configuring the app, consumers review and approve the target accounts
and auto-fulfillment settings on the listing.
Auto-fulfillment settings are only applicable for cross-region sharing.
For more information on how consumers view and approve app specifications, see Approve app specifications.
For an app specification of type LISTING, the app specification definition contains the following entries:
TARGET_ACCOUNTS: A comma-separated list of target accounts to share
data with, enclosed in single quotes. Each account must be specified in the
format OrgName.AccountName; for example:
'ProviderOrg.ProviderAccount,PartnerOrg.PartnerAccount'.
LISTING: The identifier of the listing object created by the app.
AUTO_FULFILLMENT_REFRESH_SCHEDULE: Optional. The refresh schedule for cross-region data
sharing. Can be specified as <num>MINUTE or USINGCRON<expression>.
Note
The listing name in the app specification must match an existing listing created by the app.
After this is set, the listing name cannot be changed.
If you set the manifest_version to 2 in the manifest file, Snowflake automatically grants
the CREATE SHARE and CREATE LISTING privileges to the app during installation or upgrade.
Apps can only share data from the following sources:
Databases created by the app: The app must be the owner of these databases.
Apps can choose to directly grant privileges on an object to a share or grant a database
role to share. For more information, see How to share database objects.
Apps cannot directly add target accounts to the share. This is controlled through the app specification.
To create an external listing attached to the share, add the
CREATE LISTING command to the setup script as shown in the following
example:
CREATEEXTERNALLISTINGIFNOTEXISTScompliance_listingSHAREcompliance_shareAS$$title:"Compliance Data Share"subtitle:"Regulatory compliance reporting data"description:"Share compliance and audit data with authorized accounts"listing_terms: type:"OFFLINE" $$PUBLISH=FALSEREVIEW=FALSE;
Note
Apps can only attach shares, not application packages, to a listing.
Apps cannot directly add target accounts or auto-fulfillment configuration
to the listing.
The listing manifest can only include the following properties: title,
subtitle, description, and listing_terms.
All new listings must be created in an unpublished state, with both PUBLISH
and REVIEW set to FALSE.
The listing title and description can be customized based on the consumer
info, allowing providers to distinguish data sources.
To create an app specification for a listing, follow this example:
ALTERAPPLICATIONSETSPECIFICATIONshareback_specTYPE=LISTINGLABEL='Compliance Data Sharing'DESCRIPTION='Share compliance data with provider for regulatory reporting'TARGET_ACCOUNTS='ProviderOrg.ProviderAccount,AuditorOrg.AuditorAccount'LISTING=compliance_listingAUTO_FULFILLMENT_REFRESH_SCHEDULE='720 MINUTE';
This command creates an app specification named shareback_spec that requests permission to
share data with the specified target accounts.
For cross-region sharing, the AUTO_FULFILLMENT_REFRESH_SCHEDULE parameter is required.
You can set it to one of the following values:
'<num>MINUTE': Number of minutes, with a minimum of 10 minutes,
and a maximum of 8 days or 11520 minutes (eight days)
'USINGCRON<expression><time_zone>': Cron expression with time
zone
Note
The app should only create the app specification after the listing and share objects exist.
Each listing can only have one associated app specification.
Updating the target accounts creates a new pending request for consumer approval.
Apps can validate that the listing has been properly configured after approval by running the following commands:
-- Check if the app specification is approved:SHOWAPPROVEDSPECIFICATIONSINAPPLICATION;-- Validate the listing configuration:DESCLISTINGcompliance_listing;
When implementing data sharing through app specification, consider the following
best practices:
Share integrity: Snowflake does not prevent consumers from modifying
shares created by an application. As a result, the provider is responsible
for implementing measures to protect the integrity of the underlying shared
data.
Error handling: Implement proper error handling for cases where the app
specification is declined or not yet approved.
Cross-region considerations: The app provider is responsible for setting
refresh schedules that balance data freshness requirements with cost
considerations. Although Listing Auto Fulfillment costs are billed to the app
consumer, the provider’s choice of schedule should be cost-aware to minimize
the unnecessary cost for the app consumer.
Compliance: Document clearly what data you are sharing, and why you are
sharing it, in the app specification description.
Using callback functions with LISTING app specifications¶
Apps can use lifecycle callbacks to respond when consumers approve or decline
listing specifications by adding the following code to the manifest file:
After a consumer approves the LISTING app specification and data is shared, the provider
can view the shared listing and access the data. Providers can do this using either
Snowsight or SQL.
Sign in to Snowsight as a user with the ACCOUNTADMIN role.
In the navigation menu, select Data sharing»External sharing.
Select the Shared with you tab.
Find the shareback listing from the consumer and select it.
Follow the prompts to install the listing and create a database from the shared data.
To find the listing shared by the consumer, run SHOW AVAILABLE LISTINGS
with the IS_SHARED_WITH_ME filter:
SHOWAVAILABLE LISTINGSIS_SHARED_WITH_ME=TRUE;
Identify the listing_global_name of the shareback listing from the output. Then create a
database from the listing:
Before approving a LISTING app specification, consumers should inspect the data that the app
intends to share. This provides full visibility into the actual content of a share, allowing
consumers to verify the following:
The data being shared matches what the provider described in the app specification.
No sensitive or unexpected data is included in the share.
The data meets any internal compliance or governance requirements.
Consumers can inspect data prior to approval and continue to query it at any time after approval.
Use either Snowsight or SQL to view the shared data.
Sign in to Snowsight as a user with the ACCOUNTADMIN role.
Navigate to the app’s page.
In the application page, select the Permissions tab.
Under Data sharing, click Review for a requested data share. The following
details are displayed:
The name of the data share listing
The reason that the app is requesting to share data
The accounts that have access to the data share
The replication schedule for the data share
To preview the data, click the Preview data button. The shared data is displayed in
table format, grouped by schema. Note that the shared data is not editable.
To view shared data for other schemas or tables, use the drop-down menus.
To open the data in a worksheet for further querying, click the Open in workspace button.
The Uniform Listing Locator (ULL) is a unique identifier for app-created listings that allows
consumers to query shared datasets directly. To find the ULL for a specific listing, check the
uniform_listing_locator column in the output of the SHOW LISTINGS or DESC LISTING commands.
To query the shared data, reference objects using the ULL, which contains a NATIVEAPP$
prefix followed by the listing SQL name:
This section describes limitations when using app specifications.
Auditing
Snowflake doesn’t offer built-in auditing for data that an app shares
back to the provider. If a consumer has compliance or regulatory requirements
that include an audit trail, they must coordinate directly with the provider
to implement their own separate monitoring solutions.
Sharing from within the application
Snowflake does not recommend data sharing with the provider directly from
within the application because Listing Auto Fulfillment is not currently
supported for data shared in this manner.