Creating a read-only database user in Snowflake

We typically recommend that you create a read-only trevor database user that Trevor can connect as.  You can do this easily by running the below commands against your Snowflake database:

-- Step 1. Create user 
create user trevor PASSWORD = 'your_secure_password';
create role trevor;
grant role trevor to user trevor;
alter user trevor set default_role = trevor;
-- Step 2. Grant the necessary readonly permissions
grant usage on warehouse warehouse_name_you_want_to_connect_to_trevor to role trevor;
grant usage on database database_name_you_want_to_connect_to_trevor to role trevor;
grant usage on schema database_name_you_want_to_connect_to_trevor.your_schema_name to role trevor;

grant select on all tables in schema database_name_you_want_to_connect_to_trevor.your_schema_name to role trevor;

Was this article helpful?

0 out of 0 found this helpful

Have more questions? Submit a request

Comments

0 comments

Please sign in to leave a comment.