Explore Data Products from SAP® BDC Connect for Snowflake¶
This topic describes how to use a Zero-Copy connector to list available SAP® data products, create catalog-linked databases, and query the shared data in Snowflake.
The connector must be in the CONNECTED state before you perform any of the
steps in this topic. See Set up the SAP® BDC Connect for Snowflake Zero-Copy connector.
In SAP® BDC, choose data products to share with Snowflake¶
To search for and share data products with Snowflake, users must use the central SAP Business Data Cloud catalog and have a global role that grants them the following privileges:
- BDC Data Packages (read) - To access SAP Business Data Cloud.
- Catalog Asset (read) - To access the catalog and view objects in the Assets and Data Products collections.
- Cloud Data Product (share) - To share data products to target systems.
Users with these privileges can share data products from the SAP Business Data Cloud catalog with the desired SAP Snowflake account to make them available for consumption to specific roles in that account.
To share data products with Snowflake:
- In the central SAP Business Data Cloud catalog, select data products to share with an SAP Snowflake account
- From Catalog & Marketplace, search for (or use filters) to find the data products to be shared
- From the search results, select Share in the data product to be shared (for example, customer) to open the Manage Share Access dialog
- In the Overview section, learn more about the data product by reviewing its details and available objects.
- Under Target System:
- Choose the Snowflake account with the enrolled Zero-Copy connector to share with (if there is more than one).
- Select Update.
A message confirms the share process has started. After it finishes, a notification shows the result.
In Snowflake, list shared data products¶
To list the data products that SAP® BDC has shared with your Snowflake account, call SYSTEM$ZEROCOPY_CONNECTOR_LIST_SHARES:
The function returns a JSON array. Each element represents one shared data
product. Pass the name value as SHARE_NAME when you create a
catalog-linked database, and copy that value exactly:
For a description of the output, see SYSTEM$ZEROCOPY_CONNECTOR_LIST_SHARES. The function reads the list from SAP® BDC each time you call it, so the names and descriptions are the ones that SAP® BDC currently returns. If a data product that you expect is missing, check in SAP® BDC that it’s shared with the Snowflake account and connector that you’re using.
To filter and search more easily, parse the JSON output into a tabular format
using PARSE_JSON and LATERAL FLATTEN:
Create a catalog-linked database¶
To mount a shared SAP® data product in Snowflake, create a catalog-linked database with
CREATE DATABASE … LINKED_ZEROCOPY_CONNECTOR. The role requires
the CREATE DATABASE privilege on the account and the USAGE privilege on the connector. The owner of the
catalog-linked database can be different from the owner of the connector.
Each catalog-linked database mounts exactly one data product, so specify one SHARE_NAME, copied exactly (the match
is case-sensitive). You can create multiple catalog-linked databases from the same connector, one for each data product
shared from SAP® BDC.
Snowflake populates the database in the background, so schemas and tables can take a few minutes to appear. Shortly
after you create the database, Snowflake also creates a read-only schema named SNOWFLAKE$ in it, with a semantic view
generated from the data product. For details, see The semantic view and primary keys.
SYNC_INTERVAL_SECONDS is the only property that you can change after you create the database. The Salesforce-only
properties don’t apply to SAP® BDC catalog-linked databases. For the discovery interval, see
Data freshness and refresh.
To confirm the database was created, use SHOW DATABASES:
The semantic view and primary keys¶
Each catalog-linked database has one semantic view, in its SNOWFLAKE$ schema.
Snowflake generates it from the SAP® Core Schema Notation (CSN) of the data product. The semantic view adds business
meaning to the shared data and supports AI capabilities such as
Cortex Analyst directly on top of the SAP® data in Snowflake.
Snowflake builds the view in the background after the database is created, so it can appear a few minutes after the database. The view is owned by the role that owns the database. To find it:
The semantic view is built only from the CSN, not from the tables. A column that is in a table but not in the CSN doesn’t appear in the view. Snowflake doesn’t rebuild the view automatically when the CSN changes on the SAP® side. To pick up a CSN change, call SYSTEM$ZEROCOPY_REFRESH_SEMANTIC_VIEW. The refresh runs in the background and keeps the grants on the view:
Creating your own views or semantic views inside a catalog-linked database isn’t supported. To build your own semantic view on SAP® data, create it in a different database and reference the tables of the catalog-linked database.
Snowflake also creates primary keys from the CSN. For each table whose CSN entity marks key elements, Snowflake adds
an informational PRIMARY KEY ... RELY constraint to the table. The constraint isn’t enforced. If a table already has a
different primary key, Snowflake keeps the existing key. To see the constraints, use
SHOW PRIMARY KEYS:
PII tagging and masking¶
Snowflake tags columns as personally identifiable information (PII) based on annotations in the SAP® Core Schema Notation (CSN) shared with the data product:
- Columns that the CSN marks as potentially personal or sensitive data are tagged with the
PIItag in theSNOWFLAKE$schema, shortly after the catalog-linked database is created. - A masking policy is attached to the PII tag, so query results are masked by default for every role, including ACCOUNTADMIN and the database owner role.
Important
Only grant unmasking access to roles that are authorized to view PII.
To unmask PII, the database owner role can set the UNMASK_PII tag in the catalog-linked database’s automatically created SNOWFLAKE$ schema on the role that needs to see unmasked data:
Only the session’s primary role is checked. To see unmasked values, use the tagged role as the primary role, for
example with USE ROLE my_role.
Data freshness and refresh¶
Snowflake doesn’t copy data from SAP® Business Data Cloud; queries read the data product where SAP® stores it. Three separate settings determine how current a catalog-linked database is:
- Discovery of schemas and tables: New and removed tables are picked up at the interval set by
SYNC_INTERVAL_SECONDSon the catalog-linked database. The default for SAP® BDC is 86400 seconds (24 hours). - Table metadata refresh: Existing tables pick up the latest table metadata from SAP® BDC at an interval set on the connector, which applies to every catalog-linked database of that connector. The default is 30 seconds for new connectors; existing connectors might have a different interval.
- Semantic view: Not rebuilt automatically. See The semantic view and primary keys.
Discovery of schemas and tables¶
SYNC_INTERVAL_SECONDS can range from 30 to 86400 seconds (1 day). To see the current value, call
SYSTEM$GET_CATALOG_LINKED_DATABASE_CONFIG and check sync_interval_seconds. To change it,
use ALTER DATABASE … UPDATE LINKED_ZEROCOPY_CONNECTOR:
To run discovery once without waiting for the next scheduled run, call SYSTEM$SYNC_ZEROCOPY_OBJECTS. The function starts discovery in the background and doesn’t refresh table metadata:
Both operations require the MODIFY or OWNERSHIP privilege on the catalog-linked database. To pause and resume
scheduled discovery, use ALTER DATABASE … SUSPEND DISCOVERY and RESUME DISCOVERY, which require
the OWNERSHIP privilege on the database.
Table metadata refresh¶
To see the table metadata refresh interval of a connector, call
SYSTEM$GET_ZEROCOPY_METADATA_AUTO_REFRESH_INTERVAL. To change it, call
SYSTEM$SET_ZEROCOPY_METADATA_AUTO_REFRESH_INTERVAL, which requires the MODIFY privilege
on the connector. The value must be between 30 seconds and 1 day:
A table can’t be more current in Snowflake than the data that SAP® last committed to the data product.
SYNC_INTERVAL_SECONDS and the refresh options of individual tables don’t change the table metadata refresh interval.
Check status¶
The functions that work on any catalog-linked database also work on catalog-linked databases created from a Zero-Copy connector:
- SYSTEM$CATALOG_LINK_STATUS returns the discovery status of the database, including tables that failed to load.
- SYSTEM$GET_CATALOG_LINKED_DATABASE_CONFIG returns the settings of the database, such as
sync_interval_secondsand whether discovery is suspended. - SYSTEM$AUTO_REFRESH_STATUS returns the table metadata refresh status of a table.
Explore the data¶
List the schemas and tables available in the catalog-linked database:
Query the data. Schema, table, and column names come from the data product, so
replace the names in these examples with the names returned by SHOW SCHEMAS,
SHOW TABLES, and DESC TABLE:
Catalog-linked databases created from a Zero-Copy connector are case-insensitive. The names that SHOW commands
return are in SAP® mixed case, but you can use them without double quotes, as in the preceding example.
The catalog-linked database is read-only. To transform or combine the data, create your objects in a different database, as shown in Create table as select (CTAS).
You can join tables across multiple catalog-linked databases. For example, to find the top customers by revenue using data from two shared data products:
Create table as select (CTAS)¶
To persist query results as a native Snowflake table, use CREATE TABLE AS SELECT (CTAS). Create a new database to hold the results, and replace the source table and column names with the names from your data products:
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.
Dropping and re-creating a catalog-linked database doesn’t change the data that it shows, and it removes the grants on the database and the objects in it. If data looks missing or out of date, see Troubleshoot the SAP® BDC Connect for Snowflake Zero-Copy connector.