Publish Data from Snowflake to SAP® BDC Connect for Snowflake

This topic describes how to publish Snowflake data back to SAP® BDC Connect for Snowflake by creating a share, granting access to databases, schemas, and tables, and associating the share with a Zerocopy Connector.

The connector must be in CONNECTED state and have SHARE_BACK enabled before associating a share. See Set Up SAP® BDC Connect for Snowflake Zerocopy Connector for details.

Enable Share Back

Before publishing data to SAP® BDC Connect for Snowflake, enable share back on the connector:

ALTER ZEROCOPY CONNECTOR IF EXISTS my_db.my_schema.my_sap_connector
  SET SHARE_BACK = TRUE;

Note

The role used to create the share must have the CREATE SHARE privilege on the account. For the full list of required privileges, see SAP® BDC Connect for Snowflake Zerocopy Connector — Security and Privileges.

Grant Access to Snowflake Objects

To publish Snowflake data to SAP® BDC Connect for Snowflake, you first create a Snowflake share and grant access to the databases, schemas, and tables you want to publish. For more information about creating and managing shares, see CREATE SHARE.

Note

  • Only Iceberg V3 tables with copy-on-write enabled can be shared with a Zerocopy Connector. For more information, see Use row-level deletes.

  • Iceberg tables must use Snowflake as the catalog (Snowflake-managed Iceberg tables). To specify this when creating a table, use CATALOG = 'SNOWFLAKE' and STORAGE_SERIALIZATION_POLICY = 'COMPATIBLE'. Alternatively, you can set both properties at the database or schema level so that all tables automatically inherit them. For more information, see CREATE ICEBERG TABLE (Snowflake as the Iceberg catalog).

  • Each shared data product should map to a single dedicated database.

To create an Iceberg table that can be shared with a Zerocopy Connector:

CREATE ICEBERG TABLE my_publish_db.my_schema.my_table (
  id STRING,
  name STRING,
  value NUMBER
)
  ICEBERG_VERSION = 3
  -- The following parameters can be omitted if they have been set at the parent schema, database, or account level.
  CATALOG = 'SNOWFLAKE'
  ENABLE_ICEBERG_MERGE_ON_READ = FALSE
  STORAGE_SERIALIZATION_POLICY = 'COMPATIBLE';

Create a Share

To create a share, the role must have the CREATE SHARE privilege on the account. For the full list of required privileges, see SAP® BDC Connect for Snowflake Zerocopy Connector — Security and Privileges.

Create a share using CREATE SHARE:

CREATE SHARE IF NOT EXISTS my_share;

Grant Access to the Share

Grant USAGE on the database:

GRANT USAGE ON DATABASE my_publish_db TO SHARE my_share;

Grant USAGE on the schema:

GRANT USAGE ON SCHEMA my_publish_db.my_schema TO SHARE my_share;

Grant SELECT on a specific table:

GRANT SELECT ON TABLE my_publish_db.my_schema.my_table TO SHARE my_share;

Associate the Share with the Connector

After granting access, associate the share with the Zerocopy Connector:

ALTER ZEROCOPY CONNECTOR my_db.my_schema.my_sap_connector
  ADD SHARE my_share;

To view the shares associated with a Zerocopy Connector, use DESC ZEROCOPY CONNECTOR:

DESC ZEROCOPY CONNECTOR my_db.my_schema.my_sap_connector;

Revoke Access

To disassociate a share from the Zerocopy Connector:

ALTER ZEROCOPY CONNECTOR my_db.my_schema.my_sap_connector
  REMOVE SHARE my_share;

To revoke access to a previously granted object from the share:

REVOKE USAGE ON DATABASE my_publish_db FROM SHARE my_share;

REVOKE USAGE ON SCHEMA my_publish_db.my_schema FROM SHARE my_share;

REVOKE SELECT ON TABLE my_publish_db.my_schema.my_table FROM SHARE my_share;

Publish a Data Product to SAP® BDC Connect for Snowflake

After granting access to Snowflake objects, publish the data product to SAP® BDC by calling the SYSTEM$SAP_PUBLISH_DATA_PRODUCT function. This makes the data product discoverable and accessible from the SAP® BDC side.

Note

The OPERATE privilege on the connector is required to call SYSTEM$SAP_PUBLISH_DATA_PRODUCT.

SELECT SYSTEM$SAP_PUBLISH_DATA_PRODUCT(
  '<connector_name>',
  '<snowflake_share_name>',
  '<open_resource_discovery_metadata>',
  '<csn_document_json>'
);

For example:

SELECT SYSTEM$SAP_PUBLISH_DATA_PRODUCT(
  'my_db.my_schema.my_sap_connector',
  'my_share',
  '{
    "title": "Airline Data Product",
    "shortDescription": "Airline dimension data from Snowflake.",
    "description": "Contains airline identifiers and attributes published from Snowflake to SAP BDC."
  }',
  '{
    "csnInteropEffective": "1.2",
    "$version": "2.0",
    "meta": {
      "document": {
        "version": "1.2.3",
        "doc": "This is a minimal CSN example document."
      }
    },
    "definitions": {
      "AirlineService": {
        "kind": "service",
        "doc": "This is describing the service that exposes the CDS entities through an API."
      },
      "AirlineService.Airline": {
        "kind": "entity",
        "doc": "Human readable description of the entity, in **markdown**.",
        "@EndUserText.label": "Airline",
        "@ObjectModel.modelingPattern": {
          "#": "ANALYTICAL_DIMENSION"
        },
        "elements": {
          "AirlineID": {
            "doc": "Human readable description of the element, in **markdown**.",
            "key": true,
            "type": "cds.UUID"
          }
        }
      }
    }
  }'
);

Parameter

Description

connector_name

Fully qualified name of the Zerocopy Connector (e.g., my_db.my_schema.my_sap_connector).

snowflake_share_name

Name of the Snowflake share, also the name of the share on the SAP® BDC side.

open_resource_discovery_metadata

A JSON object describing the data product in SAP® BDC. Contains the following fields:

  • title: Display name of the data product.

  • shortDescription: Brief summary of the data product.

  • description: Full description of the data product.

csn_document_json

The SAP® Core Schema Notation (CSN) JSON payload describing the structure of the data product. Provided by the caller.

Note

If the function fails to resolve connector_name or snowflake_share_name, verify that the names use the correct case. Snowflake identifiers are case-sensitive when quoted. For more information, see Identifier requirements.