Which command sequence switches the current session context to the role DBA_ROLE in Snowflake?

Master the SnowPro Advanced Architect Test with flashcards, multiple-choice questions, and detailed explanations. Prepare thoroughly for your certification!

Multiple Choice

Which command sequence switches the current session context to the role DBA_ROLE in Snowflake?

Explanation:
In Snowflake, you switch the session's active role with USE ROLE, but you can only switch to a role that is already granted to your user (directly or via another role you have). To end up as a specific role in the same session, you must first grant that role to your user and then switch to it. So the sequence that grants the role to the user and then switches the session context to that role achieves the goal: you gain the DBA_ROLE for your session, and then USE ROLE DBA_ROLE makes that role the active context for subsequent actions. The direct use of USE ROLE without having the role granted would fail, and granting the role to a role (instead of to your user) doesn’t grant you immediate access to switch.

In Snowflake, you switch the session's active role with USE ROLE, but you can only switch to a role that is already granted to your user (directly or via another role you have). To end up as a specific role in the same session, you must first grant that role to your user and then switch to it.

So the sequence that grants the role to the user and then switches the session context to that role achieves the goal: you gain the DBA_ROLE for your session, and then USE ROLE DBA_ROLE makes that role the active context for subsequent actions. The direct use of USE ROLE without having the role granted would fail, and granting the role to a role (instead of to your user) doesn’t grant you immediate access to switch.

Subscribe

Get the latest from Passetra

You can unsubscribe at any time. Read our privacy policy