- Schemas:
SEMANTIC_RELATIONSHIPS view¶
This ACCOUNT_USAGE view displays a row for each relationship defined in a semantic view.
Columns¶
Column name |
Data type |
Description |
---|---|---|
|
NUMBER |
Internal, Snowflake-generated identifier for the relationship in the semantic view. |
|
VARCHAR |
Name of the relationship in the semantic view. |
|
NUMBER |
Internal, Snowflake-generated identifier for the semantic view in which the relationship is defined. |
|
VARCHAR |
Name of the semantic view in which the relationship is defined. |
|
NUMBER |
Internal, Snowflake-generated identifier for the schema that the semantic view belongs to. |
|
VARCHAR |
Schema that the semantic view belongs to. |
|
NUMBER |
Internal, Snowflake-generated identifier for the database that the semantic view belongs to. |
|
VARCHAR |
Database that the semantic view belongs to. |
|
NUMBER |
Internal, Snowflake-generated identifier for the logical table being referenced. |
|
VARCHAR |
Name of the logical table being referenced. |
|
NUMBER |
Internal, Snowflake-generated identifier for the logical table referencing the other table. |
|
VARCHAR |
Name of the logical table referencing the other table. |
|
ARRAY(VARCHAR) |
List of the names of the columns referring to the columns of the other table. |
|
ARRAY(VARCHAR) |
List of the names of the columns being referenced. |
|
TIMESTAMP_LTZ |
Creation time of the relationship. |
|
TIMESTAMP_LTZ |
Date and time the object was last altered by a DML, DDL, or background metadata operation. See Usage Notes. |
|
TIMESTAMP_LTZ |
Date and time when the relationship was dropped. |
Usage notes¶
Latency for the view can be up to 120 minutes (2 hours).
The LAST_ALTERED column is updated when the following operations are performed on an object:
DDL operations.
DML operations (for tables only). This column is updated even when no rows are affected by the DML statement.
Background maintenance operations on metadata performed by Snowflake.
Examples¶
Retrieve the list of all relationships for the semantic view O_TPCH_SEMANTIC_VIEW
in the database MY_DB
:
SELECT * FROM SNOWFLAKE.ACCOUNT_USAGE.SEMANTIC_RELATIONSHIPS
WHERE semantic_view_name = 'O_TPCH_SEMANTIC_VIEW'
AND semantic_view_database_name = 'MY_DB';
+--------------------------+-------------------------------------------------------+------------------+----------------------+-------------------------+---------------------------+---------------------------+-----------------------------+-------------------+---------------------+-----------------+-----------------------+-------------------------+-----------------+-------------------------------+-------------------------------+---------+
| SEMANTIC_RELATIONSHIP_ID | SEMANTIC_RELATIONSHIP_NAME | SEMANTIC_VIEW_ID | SEMANTIC_VIEW_NAME | SEMANTIC_VIEW_SCHEMA_ID | SEMANTIC_VIEW_SCHEMA_NAME | SEMANTIC_VIEW_DATABASE_ID | SEMANTIC_VIEW_DATABASE_NAME | SEMANTIC_TABLE_ID | SEMANTIC_TABLE_NAME | FOREIGN_KEYS | REF_SEMANTIC_TABLE_ID | REF_SEMANTIC_TABLE_NAME | REF_KEYS | CREATED | LAST_ALTERED | DELETED |
|--------------------------+-------------------------------------------------------+------------------+----------------------+-------------------------+---------------------------+---------------------------+-----------------------------+-------------------+---------------------+-----------------+-----------------------+-------------------------+-----------------+-------------------------------+-------------------------------+---------|
| 99 | SYS_RELATIONSHIP_67ae9bb4-652a-4985-8dc5-c99fdf7f4276 | 49 | O_TPCH_SEMANTIC_VIEW | 92 | MY_SCHEMA | 7 | MY_DB | 100 | ORDERS | [ | 99 | CUSTOMER | [ | 2025-02-28 16:16:04.321 -0800 | 2025-02-28 16:16:04.321 -0800 | NULL |
| | | | | | | | | | | "O_CUSTKEY" | | | "C_CUSTKEY" | | | |
| | | | | | | | | | | ] | | | ] | | | |
| 100 | SYS_RELATIONSHIP_906b4d92-582a-4bef-b2c1-9a69e8f61af1 | 49 | O_TPCH_SEMANTIC_VIEW | 92 | MY_SCHEMA | 7 | MY_DB | 101 | LINEITEM | [ | 100 | ORDERS | [ | 2025-02-28 16:16:04.363 -0800 | 2025-02-28 16:16:04.363 -0800 | NULL |
| | | | | | | | | | | "L_ORDERKEY" | | | "O_ORDERKEY" | | | |
| | | | | | | | | | | ] | | | ] | | | |
| 101 | SYS_RELATIONSHIP_fadc2c0f-db3a-48e4-b96a-53ea2767a2b0 | 49 | O_TPCH_SEMANTIC_VIEW | 92 | MY_SCHEMA | 7 | MY_DB | 102 | SUPPLIER | [ | 98 | NATION | [ | 2025-02-28 16:16:04.376 -0800 | 2025-02-28 16:16:04.376 -0800 | NULL |
| | | | | | | | | | | "S_NATIONKEY" | | | "N_NATIONKEY" | | | |
| | | | | | | | | | | ] | | | ] | | | |
| 98 | SYS_RELATIONSHIP_8c9ad09e-0ba4-489f-aabb-0503ef80e11b | 49 | O_TPCH_SEMANTIC_VIEW | 92 | MY_SCHEMA | 7 | MY_DB | 99 | CUSTOMER | [ | 98 | NATION | [ | 2025-02-28 16:16:04.309 -0800 | 2025-02-28 16:16:04.309 -0800 | NULL |
| | | | | | | | | | | "C_NATIONKEY" | | | "N_NATIONKEY" | | | |
| | | | | | | | | | | ] | | | ] | | | |
| 97 | SYS_RELATIONSHIP_8529b4a7-eaff-4c36-888f-d9e1ad2683de | 49 | O_TPCH_SEMANTIC_VIEW | 92 | MY_SCHEMA | 7 | MY_DB | 98 | NATION | [ | 97 | REGION | [ | 2025-02-28 16:16:04.294 -0800 | 2025-02-28 16:16:04.294 -0800 | NULL |
| | | | | | | | | | | "N_REGIONKEY" | | | "R_REGIONKEY" | | | |
| | | | | | | | | | | ] | | | ] | | | |
+--------------------------+-------------------------------------------------------+------------------+----------------------+-------------------------+---------------------------+---------------------------+-----------------------------+-------------------+---------------------+-----------------+-----------------------+-------------------------+-----------------+-------------------------------+-------------------------------+---------+