GET_OBJECT_REFERENCES
functionsupportedDatabases & schemasReturns a list of objects that a specified object references. Input is currently limited to the name of a view. The following table identifies which types of database objects are currently returned in the output:
Syntax
GET_OBJECT_REFERENCES(
DATABASE_NAME => '<string>'
, SCHEMA_NAME => '<string>'
, OBJECT_NAME => '<string>' )
Parameters
| Name | Required | Description |
|---|---|---|
DATABASE_NAME => 'string' | required | Name of the database in which the schema and object reside. |
SCHEMA_NAME => 'string' | required | Name of the schema in which the object resides. |
OBJECT_NAME => 'string' | required | Name of the object. Currently limited to the name of a view (secure or not secure). |
Returns
The function returns the following columns:
Usage notes
- This function requires the following privileges: SELECT on the view. To obtain references for a view, the role in use or a role granted to the role in use must have the SELECT privilege on the view. For details, refer to Table privileges and View privileges.
- OWNERSHIP on the secure view. If the dependency chain references any secure view, the role in use or a role granted to the role in use must have the OWNERSHIP privilege on the secure view. Otherwise, Snowflake returns this error message: Copy code Insufficient privileges to operate on view '<view_name>'
- The DATABASE_NAME, SCHEMA_NAME, and OBJECT_NAME values must be enclosed in single quotes. Also, if any of these names contains any spaces, mixed-case characters, or special characters, the name must be double-quoted within the single quotes (e.g. '"My DB"' vs 'mydb').
- If the view references stages, UDFs, or materialized views, this function returns an error, rather than returning a list of referenced tables and views.