Step 3: Import Data Share to Snowflake

Import Without Database Roles

Once the Data Share is created, you can import the share to your own Snowflake account by running a set of simple SQL commands. Make sure that you are using the ACCOUNTADMIN role when importing the share.

Note that in the below CREATE DATABASE command, the first instance of YEXT is the database name you can set. YEXT is the database name we recommend, but the name is up to you. This is not to be confused with YEXT.ARGON.PROD_YEXT, which is the name of the Yext sharing database and must be written as-is.

USE ROLE ACCOUNTADMIN;

CREATE DATABASE YEXT FROM SHARE YEXT.ARGON.PROD_YEXT;

// MY_ROLE_HERE is the role you want to be able to read the database.
GRANT IMPORTED PRIVILEGES ON DATABASE YEXT TO ROLE MY_ROLE_HERE;

The GRANT IMPORTED PRIVILEGES statement just grants the two database roles to whatever user you chose, and you’ll inherit access to all of the views.

Import With Database Roles

Yext Data Sharing provides two built-in database roles for users to take advantage of – STABLE and PREVIEW.

The STABLE role gives users access to a subset of views in the share with limited risk of breaking changes, any of which will be announced well in advance.

The PREVIEW role gives users access to all views in the share, including ones that may be affected by breaking schema changes in the future.

USE ROLE ACCOUNTADMIN;

CREATE DATABASE YEXT FROM SHARE YEXT.ARGON.PROD_YEXT;

// MY_ROLE_HERE is the role you want to be able to read the database.

GRANT DATABASE ROLE YEXT.STABLE TO ROLE MY_ROLE_HERE

// Grant PREVIEW database role

Sandbox

If your Yext account is a sandbox account and you’re using Data Sharing in a sandbox environment, you can import the share by running a similar set of commands - the only difference is the share name.

Grant Imported Privileges

USE ROLE ACCOUNTADMIN;

CREATE DATABASE YEXT_SANDBOX FROM SHARE YEXT.ARGON.SBX_YEXT;

Grant Database Roles

USE ROLE ACCOUNTADMIN;

CREATE DATABASE YEXT_SANDBOX FROM SHARE YEXT.ARGON.SBX_YEXT;

GRANT DATABASE ROLE YEXT_SANDBOX.STABLE TO ROLE MY_ROLE_HERE

GRANT DATABASE ROLE YEXT_SANDBOX.PREVIEW TO ROLE MY_OTHER_ROLE_HERE

Run Sample Query

Once these statements are successfully executed, you should be all set to query the shared database! Run a sample query like the one below to make sure that the database import was successful.

select * 
from yext.public.businesses 

The output of this query should just be basic information about their Yext account.

Feedback