ExamGecko
Question list
Search
Search

Question 33 - COF-C02 discussion

Report
Export

A user needs to create a materialized view in the schema MYDB.MYSCHEMA.

Which statements will provide this access?

A.
GRANT ROLE MYROLE TO USER USER1; CREATE MATERIALIZED VIEW ON SCHEMA MYDB.MYSCHEMA TO ROLE MYROLE;
Answers
A.
GRANT ROLE MYROLE TO USER USER1; CREATE MATERIALIZED VIEW ON SCHEMA MYDB.MYSCHEMA TO ROLE MYROLE;
B.
GRANT ROLE MYROLE TO USER USER1; CREATE MATERIALIZED VIEW ON SCHEMA MYDB.MYSCHEMA TO USER USER1;
Answers
B.
GRANT ROLE MYROLE TO USER USER1; CREATE MATERIALIZED VIEW ON SCHEMA MYDB.MYSCHEMA TO USER USER1;
C.
GRANT ROLE MYROLE TO USER USER1; CREATE MATERIALIZED VIEW ON SCHEMA MYDB.MYSCHEMA TO USER1;
Answers
C.
GRANT ROLE MYROLE TO USER USER1; CREATE MATERIALIZED VIEW ON SCHEMA MYDB.MYSCHEMA TO USER1;
D.
GRANT ROLE MYROLE TO USER USER1; CREATE MATERIALIZED VIEW ON SCHEMA MYDB.MYSCHEMA TO MYROLE;
Answers
D.
GRANT ROLE MYROLE TO USER USER1; CREATE MATERIALIZED VIEW ON SCHEMA MYDB.MYSCHEMA TO MYROLE;
Suggested answer: D

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 statementGRANT ROLE MYROLE TO USER USER1;grants the specified role to the user, allowing them to assume that role and exercise its privileges. The subsequent statementCREATE MATERIALIZED VIEW ON SCHEMA MYDB.MYSCHEMA TO MYROLE;grants the privilege to create a materialized view within the specified schema to the roleMYROLE. Any user who has been grantedMYROLEcan then create materialized views inMYDB.MYSCHEMA.

References:

Snowflake Documentation on Roles

Snowflake Documentation on Materialized Views

asked 23/09/2024
Rajeev Parameswaran
38 questions
User
Your answer:
0 comments
Sorted by

Leave a comment first