SnowPro Associate: Platform exam dumps

SnowPro Associate: Platform practice question 160 of 367

SnowPro® Associate: Platform Certification. Associate level, Snowflake. Free question with the correct answer and a full explanation.

SnowPro Associate: Platform Question 160

Single answer● Understand context

A data engineering team uses a shared Snowflake worksheet to troubleshoot issues in a pipeline. The worksheet contains the following statements in order:

  1. USE ROLE SYSADMIN;
  2. USE WAREHOUSE ETL_WH;
  3. USE DATABASE RAW;
  4. USE SCHEMA INGEST;
  5. SELECT CURRENT_ROLE(), CURRENT_WAREHOUSE(), CURRENT_DATABASE(), CURRENT_SCHEMA();

Later, an engineer manually runs the following statement in the same session before re-running statement 5:

USE SCHEMA ANALYTICS.REPORTING;

What will statement 5 return after this change?

  1. A

    SYSADMIN, ETL_WH, RAW, REPORTING

  2. B

    SYSADMIN, ETL_WH, ANALYTICS, REPORTING

  3. C

    SYSADMIN, NULL, ANALYTICS, REPORTING

  4. D

    PUBLIC, ETL_WH, ANALYTICS, REPORTING

Show answer and explanation

Correct answer: B

Explanation

This question tests understanding of Snowflake session context. Snowflake maintains separate current context values for role, warehouse, database, and schema. Commands such as USE ROLE, USE WAREHOUSE, USE DATABASE, and USE SCHEMA change the current session context for subsequent statements. A key behavior is that when USE SCHEMA is executed with a fully qualified name in the form database.schema, Snowflake updates both the current schema and the current database to match that object reference. Previously set role and warehouse values remain unchanged until explicitly modified. This aligns with Snowflake documentation on session context and context functions such as CURRENT_ROLE, CURRENT_WAREHOUSE, CURRENT_DATABASE, and CURRENT_SCHEMA. Best practice in shared worksheets and scripts is to set context explicitly to avoid confusion caused by session state changes between statements.

  • A. Incorrect.

    Incorrect. When a fully qualified schema is set with USE SCHEMA ANALYTICS.REPORTING, both the current database and current schema context are updated. The schema becomes REPORTING and the database becomes ANALYTICS, not RAW. A common misconception is that USE SCHEMA changes only the schema name and leaves the current database unchanged.

  • B. Correct.

    Correct. In Snowflake, context includes the current role, warehouse, database, and schema. After USE ROLE SYSADMIN and USE WAREHOUSE ETL_WH, those values remain in effect unless explicitly changed. When the engineer runs USE SCHEMA ANALYTICS.REPORTING, Snowflake sets the current schema to REPORTING and also sets the current database to ANALYTICS because the schema was referenced with a database-qualified name.

  • C. Incorrect.

    Incorrect. The warehouse context does not reset when the schema context changes. Since ETL_WH was explicitly set earlier and no later USE WAREHOUSE statement changed it, CURRENT_WAREHOUSE() still returns ETL_WH. This distractor reflects the mistaken belief that changing database or schema context clears warehouse selection.

  • D. Incorrect.

    Incorrect. The current role remains SYSADMIN because no subsequent USE ROLE statement changed it. Also, changing schema to ANALYTICS.REPORTING does not implicitly switch the role to PUBLIC. PUBLIC is a role in Snowflake, but it is not automatically activated by changing object context.

Timed practice exam

Take a SnowPro Associate: Platform practice test under exam conditions

65 questions in 85 minutes, drawn from this bank, with a score report and a per-question review when you finish.

Start timed exam