Explore data products from Salesforce Data Cloud

This topic describes how to list available Salesforce data products, mount them as catalog-linked databases, and query the shared data in Snowflake.

Before performing the steps in this topic:

List shared data products

After your Salesforce administrator links a Data Share to the Snowflake V2 Data Share Target, call SYSTEM$ZEROCOPY_CONNECTOR_LIST_SHARES to see what’s available:

SELECT SYSTEM$ZEROCOPY_CONNECTOR_LIST_SHARES('my_db.my_schema.my_sfdc_connector');

The function returns a JSON array. Each element represents one shared data product. The name field is the value you pass as SHARE_NAME or SHARE_NAME_FILTER when creating a catalog-linked database.

[
  {
    "name": "contact_v1",
    "status": "UNMOUNTED",
    "catalog_linked_databases": []
  },
  {
    "name": "opportunity_v1",
    "status": "MOUNTED",
    "catalog_linked_databases": [ { "name": "MARKETINGSHARE" } ]
  }
]

The status field indicates whether the data share is available to mount or already mounted:

StatusDescription
UNMOUNTEDShared by Salesforce Data Cloud. No catalog-linked database has been created yet.
MOUNTEDA catalog-linked database exists for this share.

To parse the output into a tabular format:

WITH raw AS (
  SELECT PARSE_JSON(
    SYSTEM$ZEROCOPY_CONNECTOR_LIST_SHARES('my_db.my_schema.my_sfdc_connector')
  ) AS json_data
)
SELECT
  f.value:name::STRING                                              AS share_name,
  f.value:status::STRING                                           AS status,
  CASE
    WHEN ARRAY_SIZE(f.value:catalog_linked_databases) > 0
    THEN f.value:catalog_linked_databases[0]:name::STRING
    ELSE NULL
  END                                                              AS mounted_database
FROM raw,
LATERAL FLATTEN(INPUT => json_data) f;

Create a catalog-linked database

Mounting a share creates a catalog-linked database that contains the shared data as queryable schemas. Snowflake automatically creates views on top of them.

You can mount using the Snowsight UI or SQL.

Using Snowsight

  1. In Snowsight, navigate to Ingestion » Zero-Copy.
  2. Select the Available connectors tab and click your Salesforce connector.
  3. On the Catalog linked databases tab, click Mount all data shares.

The catalog-linked database is created immediately.

Using SQL

-- (Recommended) Mount all shares — each share becomes a schema
CREATE DATABASE my_sfdc_db
  LINKED_ZEROCOPY_CONNECTOR = (
    CONNECTOR_NAME = 'my_db.my_schema.my_sfdc_connector',
    ALL_SHARES = TRUE,
    SYNC_INTERVAL_SECONDS = 30  -- optional; controls how often new shares are detected
  );

-- Mount a filtered set of shares
CREATE DATABASE my_sfdc_db
  LINKED_ZEROCOPY_CONNECTOR = (
    CONNECTOR_NAME = 'my_db.my_schema.my_sfdc_connector',
    SHARE_NAME_FILTER = ('share1', 'share2')
  );

-- Mount a single share
CREATE DATABASE my_sfdc_db
  LINKED_ZEROCOPY_CONNECTOR = (
    CONNECTOR_NAME = 'my_db.my_schema.my_sfdc_connector',
    SHARE_NAME = 'my_share'
  );

To confirm the database was created:

SHOW DATABASES LIKE 'MY_SFDC_DB%';

Explore the data

Data model overview

When you mount a share, each data share appears as a schema within the catalog-linked database. Within each schema, Salesforce data objects are exposed as views.

Discover schemas and views

-- Data shares are mounted as schemas in the catalog-linked database
SHOW SCHEMAS IN DATABASE my_sfdc_db;

-- Views are the queryable layer — use these for all queries
SHOW VIEWS IN SCHEMA my_sfdc_db.my_share_schema;

-- Inspect columns before querying
SHOW COLUMNS IN VIEW my_sfdc_db.my_share_schema.ssot__Account__dlm;

Note

Views are created shortly after the catalog-linked database is mounted. If SHOW VIEWS returns no results immediately, wait for 1 minute and try again.

Query the data

Query Salesforce data via the views in each schema. The view names are determined by what your Salesforce administrator included in the Data Share.

-- Query a Data Lake Object (DLO)
SELECT * FROM my_sfdc_db.my_share_schema.Case_Home__dll LIMIT 10;

-- Query a Data Model Object (DMO)
SELECT * FROM my_sfdc_db.my_share_schema.ssot__PriceBook__dlm LIMIT 10;

-- Query a Calculated Insights Object (CIO)
SELECT * FROM my_sfdc_db.my_share_schema.Product_Sku_Aggregation__cio LIMIT 10;

Replace my_sfdc_db, my_share_schema, and the view names with the actual values returned by SHOW SCHEMAS and SHOW VIEWS in your environment.

Create table as select (CTAS)

To persist query results as a native Snowflake table for use in dashboards, ML models, or data sharing:

CREATE DATABASE IF NOT EXISTS my_ctas_db;
USE DATABASE my_ctas_db;

-- Snapshot a Salesforce data model object into a native Snowflake table
CREATE OR REPLACE TABLE account_snapshot AS
SELECT *
FROM my_sfdc_db.my_share_schema.ssot__Account__dlm;

SELECT * FROM account_snapshot LIMIT 10;

Drop a catalog-linked database

All catalog-linked databases must be dropped before you can disconnect or drop the connector. Catalog-linked databases do not support UNDROP.

DROP DATABASE my_sfdc_db;