Which SQL command can be used to see the CREATE definition of a masking policy?
Which SQL command can be used to see the CREATE definition of a masking policy?
The GET_DDL function can be used to generate the DDL statement that can be used to recreate a masking policy in SQL. This command retrieves the complete definition of the masking policy, including its creation statement, which is what the question is asking for.
This is the result of B https://docs.snowflake.com/en/sql-reference/sql/desc-masking-policy.html#example So B can't be the answer And this is the result of C https://docs.snowflake.com/en/sql-reference/functions/get_ddl.html#examples So C is the answer
B result is | 1 | SSN_MASK | (VAL VARCHAR) | VARCHAR(16777216) | case when current_role() in ('ANALYST') then val else '*********' end | C result is | create or replace view BOOKS_VIEW as select title, author from books_table; |
should be GET_DDL, describe returns only the body, not the whole create statement definition , for example input & return column data types values will be missing
C - GET_DDL returns the create statement to recreate the object. DESCRIBE will show the sql behind the policy but not in the form of a create statement.
Correct answer DESCRIBE MASKING POLICY since the question is about command. If asked about the function then GET_DDL
I think B&C https://docs.snowflake.com/en/sql-reference/sql/create-masking-policy.html#usage-notes
Going by snowflake documentation, seems both b & c is correct. https://docs.snowflake.com/en/sql-reference/sql/create-masking-policy#usage-notes
SELECT GET_DDL('MASKING POLICY', 'your_masking_policy_name');
C. GET_DDL
C https://docs.snowflake.com/en/sql-reference/functions/get_ddl Returns a DDL statement that can be used to recreate the specified object. GET_DDL currently supports the following object types: Policies (see CREATE MASKING POLICY , CREATE PASSWORD POLICY , CREATE ROW ACCESS POLICY , and CREATE SESSION POLICY , CREATE AUTHENTICATION POLICY)
B is the answer if you want to replace an existing masking policy and need to see the current definition of the policy, call the GET_DDL function or run the DESCRIBE MASKING POLICY command.
B is the answer
https://docs.snowflake.com/en/sql-reference/sql/desc-masking-policy DESC MASKING POLICY
B is the correct answer
C for Sure