COF-C02 · Question #686
COF-C02 Question #686: Real Exam Question with Answer & Explanation
The correct answer is D: GRANT ROLE MYROLE TO USER USER1;. In Snowflake, to create a materialized view, the user must have the necessary privileges on the schema where the view will be created. These privileges are granted through roles, not directly to individual users. Therefore, the correct process is to grant the role to the user and
Question
A user needs to create a materialized view in the schema MYDB.MYSCHEMA. Which statements will provide this access?
Options
- AGRANT ROLE MYROLE TO USER USER1;
- BGRANT ROLE MYROLE TO USER USER1;
- CGRANT ROLE MYROLE TO USER USER1;
- DGRANT ROLE MYROLE TO USER USER1;
Explanation
In Snowflake, to create a materialized view, the user must have the necessary privileges on the schema where the view will be created. These privileges are granted through roles, not directly to individual users. Therefore, the correct process is to grant the role to the user and then grant the privilege to create the materialized view to the role itself. The statement GRANT ROLE MYROLE TO USER USER1; grants the specified role to the user, allowing them to assume that role and exercise its privileges. The subsequent statement CREATE MATERIALIZED VIEW ON SCHEMA MYDB.MYSCHEMA TO MYROLE; grants the privilege to create a materialized view within the specified schema to the role MYROLE. Any user who has been granted MYROLE can then create materialized views in MYDB.MYSCHEMA.
Topics
Community Discussion
No community discussion yet for this question.