nerdexam
Snowflake

ADA-C01 · Question #84

A Snowflake Administrator needs to persist all virtual warehouse configurations for auditing and backups. Given a table already exists with the following schema: Table Name : VWH_META Column 1…

The correct answer is C. 1. SHOW WAREHOUSES. According to the Using Persisted Query Results documentation, the RESULT_SCAN function allows you to query the result set of a previous command as if it were a table. The LAST_QUERY_ID function returns the query ID of the most recent statement executed in the current session…

Resource Management and Cost Optimization

Question

A Snowflake Administrator needs to persist all virtual warehouse configurations for auditing and backups. Given a table already exists with the following schema:

Table Name : VWH_META Column 1 : SNAPSHOT_TIME TIMESTAMP_NTZ Column 2 : CONFIG VARIANT Which commands should be executed to persist the warehouse data at the time of execution in JSON format in the table VWH META?

Options

  • A
    1. SHOW WAREHOUSES;
  • B
    1. SHOW WAREHOUSES;
  • C
    1. SHOW WAREHOUSES;
  • D
    1. SHOW WAREHOUSES;

How the community answered

(15 responses)
  • A
    7% (1)
  • B
    7% (1)
  • C
    73% (11)
  • D
    13% (2)

Explanation

According to the Using Persisted Query Results documentation, the RESULT_SCAN function allows you to query the result set of a previous command as if it were a table. The LAST_QUERY_ID function returns the query ID of the most recent statement executed in the current session. Therefore, the combination of these two functions can be used to access the output of the SHOW WAREHOUSES command, which returns the configurations of all the virtual warehouses in the account. However, to persist the warehouse data in JSON format in the table VWH_META, the OBJECT_CONSTRUCT function is needed to convert the output of the SHOW WAREHOUSES command into a VARIANT column. The OBJECT_CONSTRUCT function takes a list of key-value pairs and returns a single JSON object. Therefore, the correct commands to 1. SHOW WAREHOUSES; 2. INSERT INTO VWH_META SELECT CURRENT_TIMESTAMP (), OBJECT_CONSTRUCT (*) FROM TABLE (RESULT_SCAN (LAST_QUERY_ID ()));

Topics

#virtual warehouse#SHOW WAREHOUSES#RESULT_SCAN#auditing

Community Discussion

No community discussion yet for this question.

Full ADA-C01 Practice