Sharing Unstructured Data

Data providers can use Secure Data Sharing to share unstructured data files with data consumers.

In this Topic:

Step 1: Creating Secure Views

Creating and managing shares that include unstructured data in secure views does not differ significantly from the general instructions. For information, see Working with Shares.

Create secure views (using the CREATE SECURE VIEW syntax) that allow data consumers to retrieve scoped or pre-signed URLs for unstructured data files.

The following examples create secure views that allow data consumers to query the scoped or pre-signed URLs for a specific set of staged files. Both views query the relative_file_path column in a directory table to retrieve the scoped or pre-signed URL.

Scoped URL

Call the BUILD_SCOPED_FILE_URL function to retrieve the scoped URL for a set of staged files. The SQL function accepts the relative_path column in the directory table on the stage as input:

CREATE OR REPLACE SECURE VIEW images_scoped_v AS
  SELECT BUILD_SCOPED_FILE_URL(@mystage, relative_path) AS scoped_file_url
    FROM DIRECTORY(@mystage);

Pre-signed URL

Call the GET_PRESIGNED_URL function to retrieve the pre-signed URL for a set of staged files. The SQL function accepts the relative_path column in the directory table on the stage as input:

CREATE OR REPLACE SECURE VIEW images_presigned_v AS
  SELECT GET_PRESIGNED_URL(@mystage, relative_path) AS presigned_url
    FROM DIRECTORY(@mystage);

Step 2: Creating Shares

Create a share, and grant privileges on the secure views to the share. Add consumer accounts to the share.

For instructions, see Working with Shares.