While in general it's easiest to get started with hyperquery by simply using any existing account that can query tables, it can be cleaner to create a dedicated Snowflake account for us to use with a dedicated role. We'll go through the following steps here:
- Create a new role and a new user.
- Create a new warehouse [optional].
We'll provide you a series of commands that can be executed in the Snowflake console to accomplish this. Remember to run all of the commands - by default the "Run" button in the Snowflake GUI will only run the query that is beneath the cursor (each of the following code blocks is comprised of multiple queries!).
🆕 Create a new role and user
We'll start by creating a new role,
hq_role. Modify the password field below before executing.
use role accountadmin; create role if not exists hq_role; grant role hq_role to role SYSADMIN; create user if not exists hq_user password = '<enter password here>'; grant role hq_role to user hq_user; alter user hq_user set default_role = hq_role;
📖 Grant access to your new role
The following will grant two kinds of privileges:
SELECT. Read more about Snowflake privileges here.
grant usage on database <your_database> to role hq_role; grant usage on future schemas in database <your_database> to role hq_role; grant select on future tables in database <your_database> to role hq_role;
Depending on how you want to use hyperquery, you may want to add additional privileges -- users commonly grant
create permissions as well.
See this article if you want to add schema-level (or tighter) restrictions at the Snowflake-level.
🏢 Create a new warehouse [optional]
You're welcome to use an existing warehouse, but if you'd like to customize the experience for your team, you can create a new warehouse as follows below. Make sure to customize the size of the warehouse.
create warehouse if not exists hq_wh warehouse_size = small warehouse_type = standard auto_suspend = 1800 auto_resume = true initially_suspended = true; grant all privileges on warehouse hq_wh to role hq_role;
You should be good to go!
To connect this warehouse, specify the following details in your warehouse connection, along with your other connection details.
username: hq_user warehouse: hq_wh
Feel free to reach out to us on slack, email, or intercom if you have any questions. We're here to help!
Updated 12 months ago