Using Contacts¶
Contacts are schema-level objects that contain details about how to communicate with a user or group of users. For example, one contact
named data_stewards
might include an email distribution list while another named support_department
might include the URL of the
department’s website.
Contacts can be associated with other objects such as databases and tables so users know who to contact for assistance with the object. For example, there might be a contact on a table that describes who to reach out to in order to gain access to the table. The purpose of the contact is not a property of the contact, but rather the association between a contact and a specific object. For example, the same contact might provide general support for one table while providing access approval for another.
An object can have more than one contact as long as the purpose of each contact is unique for the object. For example, a table might have one contact that grants access to the table and another contact that provides general support for the table. When a user views the contacts associated with an object, they see the purpose of each contact along with a communication method, so they know who to communicate with for a specific reason and how to reach them.
Data users see these contacts when they are using the Data menu in Snowsight to navigate their databases, schemas, and table-like objects.
Inheriting and overriding contacts¶
Contacts are inherited by descendant objects. If you associate a contact with an object that is the parent of another object, the child, grandchild, and so on inherit the contact. For example, if you associate a contact with a schema, all of the tables in the schema inherit the contact by default.
Contact inheritance is overridden if a child object has a contact with the same purpose. For example, suppose someone associates the
following two contacts with the ac_sch
schema, which contains the table t1
:
Contact |
Purpose |
---|---|
|
Steward |
|
Approver |
Now suppose someone associates the contact finance_dept
with t1
for the purpose of access approval. The contacts associated with
t1
are now the following:
Contact |
Purpose |
---|---|
|
Steward |
|
Approver |
The contact responsible for access approval on the ac_schema
has been replaced with a contact directly associated with t1
, but
t1
continues to inherit the data_stewards
contact from the schema.
Supported objects¶
You can associate a contact with the following objects:
|
|
|
Create a contact¶
When you create a contact, you specify the name of the contact and how someone should communicate with the contact. Communication methods include the following:
The URL of a website.
An email address, which can be a distribution list.
A list of Snowflake users.
You can create a contact using Snowsight or SQL. It can be helpful to create all contacts in a dedicated schema.
- Snowsight:
Sign in to Snowsight.
Select Data.
Navigate to the schema where you want to create the contact.
Select Create » Contact.
Specify the name of the contact.
Choose a communication method, then specify the email address, users, or URL that data users will contact for assistance with an object.
Select the roles that will have the ability to associate the contact with objects. These roles are granted the APPLY privilege on the contact.
Select Create.
- SQL:
You can execute the CREATE CONTACT command to create a new contact.
Examples
Create a contact for the support team that is reached through their website.
CREATE CONTACT support_dept URL = 'http://internalsupport.example.com';
Create a contact for the finance team that is reached via an email address, which acts as a distribution list.
CREATE CONTACT finance_dept EMAIL_DISTRIBUTION_LIST = 'fd_dl@example.com';
Create a contact for database administrators, as identified by the name of their Snowflake user objects.
CREATE CONTACT db_admins USERS = (ex_admin1, ex_admin2);
Associate a contact with an object¶
When you associate a contact with an object, you specify the name of the contact along with the purpose of the association between the contact and the object. When users view all of the contacts associated with an object, they’ll be able decide who to communicate with based on the purpose of each contact.
The purpose of having a contact associated with an object can be one of the following:
Purpose |
Description |
SQL value |
---|---|---|
Steward |
Provides information about the accuracy, consistency, and reliability of data. |
|
Support |
Provides technical support related to a dataset. |
|
Approver |
Approves or rejects requests to access data. |
|
You can associate a contact and define its purpose when modifying an existing object or creating a new object.
Associate a contact with an existing object¶
- Snowsight:
Sign in to Snowsight.
Select Data » Databases.
Navigate to one of the supported objects.
Select the Details tab.
Find the Assigned Contacts section and select the Edit icon.
Select a contact for one or more of the purposes. For example, if you select a contact from the Approver drop-down list, data users will reach out to that contact when they need access to the object.
Select Save.
- SQL:
The ALTER … SET CONTACT command for an existing object lets you associate a contact and specify the purpose of the contact for that object. The syntax to associate the contact is the same for all objects that can be associated with a contact:
ALTER <object_type> <object_name> SET CONTACT <purpose> = <contact_name> [ , <purpose> = <contact_name> ... ]
The
purpose
must be one of the predefined purposes, which describe the contact’s relationship to the object. When users view the contacts of an object, they use the purpose to determine which of the contacts to communicate with.Examples
Associate the
finance_dept
contact with a table so users know who to communicate with when they need access to the table:ALTER TABLE t1 SET CONTACT ACCESS_APPROVAL = finance_dept;
Associate the
internal_support
contact with a database so users know who to communicate with when they need general support for a table in the database:ALTER DATABASE my_db SET CONTACT SUPPORT = internal_support;
Associate the
data_stewards
contact with a schema so users know who to communicate with regarding object tagging of tables in the schema:ALTER SCHEMA sch1 SET CONTACT STEWARD = data_stewards;
Associate a contact when creating a new object¶
The CREATE … WITH CONTACT command lets you associate a contact with a new object. The syntax for the WITH CONTACT clause is the same for all objects that can be associated with a contact:
WITH CONTACT ( <purpose> = <contact_name> [ , <purpose> = <contact_name> ... ] )
The purpose
must be one of the predefined purposes, which describe the contact’s
relationship to the object. When users view the contacts of an object, they use the purpose to determine which of the contacts to
communicate with.
For tables and table-like objects, the WITH CONTACT clause is specified after the column definitions.
Examples¶
Associate the finance_dept
contact with a new table so users know who to communicate with when they need access to the table:
CREATE TABLE t1 (col1 VARCHAR, col2 INT) WITH CONTACT (ACCESS_APPROVAL = finance_dept);
Associate the internal_support
contact with a new database so users know who to communicate with when they need general support for a
table in the database:
CREATE DATABASE my_db WITH CONTACT (SUPPORT = internal_support);
Associate the data_stewards
contact with a new schema so users know who to communicate with regarding object tagging of tables in the
schema and the finance_dept
contact so users know who to communicate with when they need access:
CREATE SCHEMA sch1 WITH CONTACT (STEWARD = data_stewards, ACCESS_APPROVAL = finance_dept);
Detach a contact from an object¶
- Snowsight:
Sign in to Snowsight.
Select Data » Databases.
Navigate to the object.
Select the Details tab.
Find the Assigned Contacts section and select the Edit icon.
Find the purpose (for example, Approver) that has the contact that you want to detach, and use the drop-down list to select None.
Select Save.
- SQL:
The ALTER … UNSET CONTACT commands lets you detach a contact from an object. The syntax to detach the contact is the same for all objects that can be associated with a contact:
ALTER <object_type> <object_name> UNSET CONTACT <purpose>
You identify the contact to detach by specifying the purpose of the association between the contact and the object, not by the contact name. For a list of possible purposes that can be specified to detach a contact, see predefined purposes.
For example, to detach the contact that was added as the STEWARD of a table, execute:
ALTER TABLE t1 UNSET CONTACT STEWARD;
View contacts for an object¶
- Snowsight:
When you navigate to an object in Snowsight, the contacts that are associated with the object appear on the Details tab.
- SQL:
Users with at least one privilege on an object can use the GET_CONTACTS table function to view the contacts associated with that object. The function returns a row for each contact associated with the object.
For example, to list the contacts on the table
t1
, a user with at least one privilege can execute the following:SELECT * FROM TABLE(SNOWFLAKE.CORE.GET_CONTACTS('t1', 'TABLE'));
For each contact, the function lists the following:
Purpose of the contact.
Method of communication for the contact.
Whether the contact was associated with the object directly or inherited from a parent object.
Governing contacts and their associations¶
- Snowsight:
To list the contacts that have been created in a schema and drill down into the details for a specific contact:
Sign in to Snowsight.
Use the Data » Databases menu to navigate to the schema.
Select the Contacts tab.
Select a contact if you want to view details about it, including the objects with which it is associated.
- SQL:
The ACCOUNT_USAGE schema provides the following views to help manage contacts:
CONTACTS view - Lists all contacts in the account.
CONTACT_REFERENCES view - Lists the objects with which a contact has been associated.
Access control privileges¶
The following summarizes the privileges a user needs to work with contacts.
Task |
Required privileges |
---|---|
Both of the following:
|
|
Either of the following:
|
|
Any privilege on the object. |
|
Either of the following:
|
|
Either of the following:
|
|
OWNERSHIP on the contact |