snowflake-cloud-data-platformdatabase-administrationdatabase-permissions

Snowflake - Grant permissions by username


I'm trying to restrict read permissions on some entities to a specific user.

In Oracle I'd simply do

GRANT SELECT ON sensitive_schema.my_table1 TO error_2646;
GRANT SELECT ON sensitive_schema.my_table2 TO error_2646;
GRANT SELECT ON sensitive_schema.my_tableN TO error_2646;

or ideally at schema level

GRANT SELECT ON sensitive_schema TO error_2646;

Can I do this in Snowflake? In the documentation it looks like permissions are managed by role in Snowflake and I'd rather not change this person's role.

https://docs.snowflake.com/en/sql-reference/sql/grant-privilege.html


Solution

  • As Snowflake's approch for permission is Role-based Access Control (RBAC) you will not be able to give GRANTS to a specific user.

    If you absolutly don't want to work on role for this, maybe you can have a look on Dynamic Data Masking. You will be able to mask data to a specific user using current_user(). But you will have to create a masking policy for every field type you want to mask and apply this policy to every field in your table so i would not recommend this compared to role approach.