CREATE ROLE IF NOT EXISTS transform;
GRANT ROLE TRANSFORM TO ROLE ACCOUNTADMIN;
1.4 创建dbt角色并给该角色授权
创建dbt
CREATE USER IF NOT EXISTS dbt
PASSWORD='shangxi123'
LOGIN_NAME='dbt'
MUST_CHANGE_PASSWORD=FALSE
DEFAULT_WAREHOUSE='COMPUTE_WH'
DEFAULT_ROLE='transform'
DEFAULT_NAMESPACE='AIRBNB.RAW'
COMMENT='DBT user used for data transformation';
授权
--授权warehouse的操作给transform
GRANT OPERATE ON WAREHOUSE COMPUTE_WH TO ROLE TRANSFORM;
--将transform的角色赋给dbt
GRANT ROLE transform to USER dbt;
--授权warehouse给transform
GRANT ALL ON WAREHOUSE COMPUTE_WH TO ROLE transform;
--授权schema给transform
GRANT ALL ON DATABASE AIRBNB to ROLE transform;
--授权database给warehouse
GRANT ALL ON DATABASE AIRBNB to ROLE transform;
--授权database给transform
GRANT ALL ON ALL SCHEMAS IN DATABASE AIRBNB to ROLE transform;
--授权schema给transform
GRANT ALL ON FUTURE SCHEMAS IN DATABASE AIRBNB to ROLE transform;
--授权表给transform
GRANT ALL ON ALL TABLES IN SCHEMA AIRBNB.RAW to ROLE transform;
GRANT ALL ON FUTURE TABLES IN SCHEMA AIRBNB.RAW to ROLE transform;