...
Code Block |
---|
USE ROLE ACCOUNTADMIN;
CREATE ROLE IF NOT EXISTS CALLPOTENTIAL_ROLE;
GRANT ROLE CALLPOTENTIAL_ROLE TO ROLE SYSADMIN;
-- Create a warehouse
CREATE WAREHOUSE IF NOT EXISTS CALLPOTENTIAL_WAREHOUSE WITH WAREHOUSE_SIZE = XSMALL
AUTO_SUSPEND = 60
AUTO_RESUME = TRUE
INITIALLY_SUSPENDED = FALSE;
GRANT USAGE ON WAREHOUSE CALLPOTENTIAL_WAREHOUSE TO ROLE CALLPOTENTIAL_ROLE;
GRANT OPERATE ON WAREHOUSE CALLPOTENTIAL_WAREHOUSE TO ROLE CALLPOTENTIAL_ROLE;
GRANT MONITOR ON WAREHOUSE CALLPOTENTIAL_WAREHOUSE TO ROLE CALLPOTENTIAL_ROLE;
-- Create a non-administrator user that has read-only access to the data
-- This user should be used by scripts that dump data to .csv, for example.
CREATE USER IF NOT EXISTS CALLPOTENTIAL WITH DEFAULT_ROLE = CALLPOTENTIAL_ROLE
DEFAULT_WAREHOUSE = CALLPOTENTIAL_WAREHOUSE;
ALTER USER CALLPOTENTIAL SET DEFAULT_NAMESPACE = "CALLPOTENTIAL.EXPORTS";
GRANT ROLE CALLPOTENTIAL_ROLE TO USER CALLPOTENTIAL;
-- Create the shared database
CREATE DATABASE IF NOT EXISTS "CALLPOTENTIAL" FROM SHARE QAA98122."EXPORTS" COMMENT='Shared data from Call Potential';
GRANT IMPORTED PRIVILEGES ON DATABASE "CALLPOTENTIAL" TO ROLE "CALLPOTENTIAL_ROLE";
-- Set the password to your choice. You can run this command again to change it.
ALTER USER CALLPOTENTIAL SET PASSWORD = 'MyPassword12345!';
|
...