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).
Syntax¶
Where:
The share options depend on the partner. For more information, see Share options for each partner.
Required parameters¶
nameSpecifies 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_CATALOGor with other database options, such asEXTERNAL_VOLUME. OnlyCOMMENTis 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 theCONNECTEDstate.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_SHARESfunction.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 = TRUEMounts 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 = valueSpecifies 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 secondsSALESFORCE: 300 secondsWORKDAY: 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:
FALSESALESFORCE_USER_FRIENDLY_NAME = { TRUE | FALSE }Salesforce only. Specifies whether Snowflake adds views with short names, in which the object type suffix and the
__csuffix of column names are removed.Default:
TRUE
The Salesforce options are accepted only for Salesforce connectors.
Share options for each partner¶
| Partner | Share options | What the database contains |
|---|---|---|
SAP_BDC |
| 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 | One schema for each share. |
WORKDAY | None. | 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:
| Privilege | Object | Notes |
|---|---|---|
| CREATE DATABASE | Account | Required 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. |
| USAGE | Zero-Copy connector | Required 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 theSYSTEM$ZEROCOPY_REFRESH_SEMANTIC_VIEWfunction. - 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 theSYSTEM$SYNC_ZEROCOPY_OBJECTSfunction. - 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_INTERVALandSYSTEM$SET_ZEROCOPY_METADATA_AUTO_REFRESH_INTERVALfunctions. - 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
RENAMEorSWAP, 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_CONFIGfunction. 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_DDLdoesn’t return a statement that you can use to re-create the database.
Examples¶
Mount one SAP BDC data product:
Mount all Salesforce Data Cloud shares:
Mount two Salesforce Data Cloud shares, and set the optional Salesforce properties:
Mount the Workday Data Cloud catalog: