CREATE DATABASE (zero-copy connector-linked)

Creates a read-only catalog-linked database that mounts data from a data partner (SAP® Business Data Cloud, Salesforce Data Cloud, or Workday Data Cloud) through a Zero-Copy connector. Snowflake reads the data in place and doesn’t copy it.

To create a catalog-linked database for an Apache Iceberg™ REST catalog, see CREATE DATABASE (catalog-linked).

See also:

ALTER DATABASE (zero-copy connector-linked) , CREATE ZEROCOPY CONNECTOR , ALTER ZEROCOPY CONNECTOR , DESCRIBE ZEROCOPY CONNECTOR

Syntax

CREATE DATABASE <name>
  LINKED_ZEROCOPY_CONNECTOR = ( zerocopyParams )
  [ COMMENT = '<string_literal>' ]

Where:

zerocopyParams ::=
  CONNECTOR_NAME = '<connector_name>'
  [ , SHARE_NAME = '<share_name>' ]
  [ , SHARE_NAME_FILTER = ( '<share_name1>' [ , '<share_name2>' , ... ] ) ]
  [ , ALL_SHARES = TRUE ]
  [ , SYNC_INTERVAL_SECONDS = <value> ]
  [ , LEGACY_SALESFORCE_SCHEMA_ALIAS = { TRUE | FALSE } ]
  [ , SALESFORCE_USER_FRIENDLY_NAME = { TRUE | FALSE } ]

The share options depend on the partner. For more information, see Share options for each partner.

Required parameters

name

Specifies the identifier for the catalog-linked database; must be unique for your account.

In addition, the identifier must start with an alphabetic character and cannot contain spaces or special characters unless the entire identifier string is enclosed in double quotes (for example, "My object"). Identifiers enclosed in double quotes are also case-sensitive.

For more information, see Identifier requirements.

LINKED_ZEROCOPY_CONNECTOR = ( ... )

Specifies the connector and the data to mount. For the properties, see Zero-Copy connector parameters (zerocopyParams).

Combining this parameter with LINKED_CATALOG or with other database options, such as EXTERNAL_VOLUME. Only COMMENT is accepted.

Optional parameters

COMMENT = 'string_literal'

Specifies a comment for the database.

Default: No value

Zero-Copy connector parameters (zerocopyParams)

CONNECTOR_NAME = 'connector_name'

Required. Specifies the name of the Zero-Copy connector. Use the fully qualified name ('<db>.<schema>.<connector>'). The connector must be in the CONNECTED state.

SHARE_NAME = 'share_name'

Specifies the name of a single data product (SAP BDC) or data share (Salesforce) to mount. The name must match exactly. To list the names that you can specify, call the SYSTEM$ZEROCOPY_CONNECTOR_LIST_SHARES function.

SHARE_NAME_FILTER = ( 'share_name1' [ , 'share_name2' , ... ] )

Salesforce only. Specifies the names of the data shares to mount. Each share becomes a schema in the database.

ALL_SHARES = TRUE

Mounts all shares of the connector. Each share becomes a schema in the database. Snowflake adds and removes schemas as the shares in the partner change.

SYNC_INTERVAL_SECONDS = value

Specifies the time interval in seconds that Snowflake uses to discover new and removed schemas and tables in the partner. This interval controls discovery only. It isn’t how often existing tables pick up the latest table metadata.

Values: 30 to 86400 (1 day), inclusive

Default: Depends on the partner of the connector:

  • SAP_BDC: 86400 seconds
  • SALESFORCE: 300 seconds
  • WORKDAY: 86400 seconds
LEGACY_SALESFORCE_SCHEMA_ALIAS = { TRUE | FALSE }

Salesforce only. Specifies whether Snowflake also exposes each share under its Salesforce Data Cloud V1 schema name as pass-through views.

Default: FALSE

SALESFORCE_USER_FRIENDLY_NAME = { TRUE | FALSE }

Salesforce only. Specifies whether Snowflake adds views with short names, in which the object type suffix and the __c suffix of column names are removed.

Default: TRUE

The Salesforce options are accepted only for Salesforce connectors.

Share options for each partner

PartnerShare optionsWhat the database contains
SAP_BDC

SHARE_NAME is required. SHARE_NAME_FILTER and ALL_SHARES aren’t supported. Create one database for each data product.

One data product. Snowflake also adds a SNOWFLAKE$ schema that contains a semantic view generated from the data product’s CSN.
SALESFORCE

Specify exactly one of SHARE_NAME, SHARE_NAME_FILTER, or ALL_SHARES = TRUE.

One schema for each share.
WORKDAY

None. SHARE_NAME and SHARE_NAME_FILTER aren’t supported. ALL_SHARES = TRUE is accepted but isn’t needed.

The whole Workday Data Cloud catalog, with one schema for each Workday namespace.

Access control requirements

A role used to execute this operation must have the following privileges at a minimum:

PrivilegeObjectNotes
CREATE DATABASEAccountRequired to create a new database. Only the SYSADMIN role, or a higher role, has this privilege by default. The privilege can be granted to additional roles as needed.
USAGEZero-Copy connectorRequired to reference the connector. Snowflake checks this privilege on your primary role only. Secondary roles aren’t considered.

The owner of the database can be a different role from the owner of the connector.

For instructions on creating a custom role with a specified set of privileges, see Creating custom roles.

For general information about roles and privilege grants for performing SQL actions on securable objects, see Overview of Access Control.

Usage notes

  • The database is read-only. Writing to its tables or creating views, semantic views, or other objects in it isn’t supported.
  • For Salesforce, Snowflake manages the views in the database. You can query them; altering or dropping them isn’t supported. The tables that the views read from aren’t accessible.
  • For SAP BDC, Snowflake creates the semantic view in the SNOWFLAKE$ schema after the database is created, but doesn’t rebuild it when the CSN changes. To rebuild it, call the SYSTEM$ZEROCOPY_REFRESH_SEMANTIC_VIEW function.
  • Snowflake populates the database in the background, so schemas and tables can take a few minutes to appear after the statement returns.
  • Snowflake doesn’t copy the data. Queries read what the partner currently has.
  • Discovery of new and removed schemas and tables follows SYNC_INTERVAL_SECONDS. To change it later, see ALTER DATABASE (zero-copy connector-linked). To run discovery once right away, call the SYSTEM$SYNC_ZEROCOPY_OBJECTS function.
  • How often existing tables pick up the latest table metadata is set for each connector and applies to every database that is created from it. To read or change it, use the SYSTEM$GET_ZEROCOPY_METADATA_AUTO_REFRESH_INTERVAL and SYSTEM$SET_ZEROCOPY_METADATA_AUTO_REFRESH_INTERVAL functions.
  • The role that owns the database must keep the USAGE privilege on the connector. If it loses the privilege, Snowflake stops discovering new schemas and tables. To transfer ownership of the database with GRANT OWNERSHIP, the new owner role must have USAGE on the connector.
  • Moving objects into or out of the database with RENAME or SWAP, renaming its schemas, and replicating the database aren’t supported.
  • Granting an SAP BDC database to a share isn’t supported.
  • To read the connector name and Salesforce options of the database, call the SYSTEM$GET_ZEROCOPY_CONNECTOR_LINKED_DATABASE_CONFIG function. To read the sync interval, call SYSTEM$GET_CATALOG_LINKED_DATABASE_CONFIG.
  • The functions that work on any catalog-linked database also work on these databases: SYSTEM$CATALOG_LINK_STATUS for the discovery status, SYSTEM$GET_CATALOG_LINKED_DATABASE_CONFIG for the database settings, and SYSTEM$AUTO_REFRESH_STATUS for the table metadata refresh status of a table.
  • GET_DDL doesn’t return a statement that you can use to re-create the database.

Examples

Mount one SAP BDC data product:

CREATE DATABASE my_sales_order
  LINKED_ZEROCOPY_CONNECTOR = (
    CONNECTOR_NAME = 'my_db.my_schema.my_sap_connector',
    SHARE_NAME = 'usid:b077d21c-b7a2-479a-a20e-bba1dbe91034:ns:sap.s4pce:r:SalesOrder:v:1',
    SYNC_INTERVAL_SECONDS = 86400
  );

Mount all Salesforce Data Cloud shares:

CREATE DATABASE my_sfdc_db
  LINKED_ZEROCOPY_CONNECTOR = (
    CONNECTOR_NAME = 'my_db.my_schema.my_sfdc_connector',
    ALL_SHARES = TRUE
  );

Mount two Salesforce Data Cloud shares, and set the optional Salesforce properties:

CREATE DATABASE my_sfdc_db
  LINKED_ZEROCOPY_CONNECTOR = (
    CONNECTOR_NAME = 'my_db.my_schema.my_sfdc_connector',
    SHARE_NAME_FILTER = ('share1', 'share2'),
    SYNC_INTERVAL_SECONDS = 300,
    LEGACY_SALESFORCE_SCHEMA_ALIAS = FALSE,
    SALESFORCE_USER_FRIENDLY_NAME = TRUE
  );

Mount the Workday Data Cloud catalog:

CREATE DATABASE my_workday_db
  LINKED_ZEROCOPY_CONNECTOR = (
    CONNECTOR_NAME = 'my_db.my_schema.my_workday_connector'
  );