Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | |||||
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
Tags
- 웨일즈
- 중국외교부
- 코로나19
- 최성재
- 신종코로나
- cnn
- 어서와한국은처음이지
- 정은경 본부장님
- 우한코로나
- 조현병
- red hearse
- 창궐
- 우한 코로나
- wuhan
- 필리핀사망
- 봉준호감독통역사
- sharonchoi
- parasite
- 진짜영웅
- 치앙마이
- Bolton
- 코로나
- 우한코로나바이러스
- everybody wants you
- 코로나바이러스
- 전염병
- 봉준호감독통역
- 확진자수
- 미중
- 우한
Archives
- Today
- Total
오지's blog
snowflake db구성에 관한 쿼리 본문
728x90
반응형
-- CREATE
-- WAREHOUSE
CREATE OR REPLACE WAREHOUSE A_WH
WAREHOUSE_SIZE=XSMALL
MAX_CLUSTER_COUNT=1
MIN_CLUSTER_COUNT=1
SCALING_POLICY=ECONOMY
AUTO_SUSPEND=60
AUTO_RESUME = TRUE;
-- DATABASE
CREATE OR REPLACE TRANSIENT DATABASE A_WDB;
-- SCHEMA
CREATE OR REPLACE TRANSIENT SCHEMA ODS;
CREATE OR REPLACE TRANSIENT SCHEMA DW;
CREATE OR REPLACE TRANSIENT SCHEMA DM;
-- ROLE
CREATE OR REPLACE ROLE READ_ROLE COMMENT = 'A ROLE FOR SELECT ONLY';
CREATE OR REPLACE ROLE CRUD_ROLE COMMENT = 'A ROLE FOR CREATE/SELECT/UPDATE/DELETE';
CREATE OR REPLACE ROLE OBJECT_ROLE COMMENT = 'A ROLE FOR DBA';
-- USER
CREATE OR REPLACE USER A_DBA
PASSWORD = '***'
LOGIN_NAME = A_DBA
DISPLAY_NAME = A_DBA
MUST_CHANGE_PASSWORD = FALSE
DEFAULT_WAREHOUSE = A_WDB
DEFAULT_ROLE = OBJECT_ROLE
COMMENT = 'DBA';
CREATE OR REPLACE USER A_ETL
PASSWORD = '***'
LOGIN_NAME = A_ETL
DISPLAY_NAME = A_ETL
MUST_CHANGE_PASSWORD = FALSE
DEFAULT_WAREHOUSE = A_WDB
DEFAULT_ROLE = CRUD_ROLE
COMMENT = 'CREATE/SELECT/UPDATE/DELETE';
CREATE OR REPLACE USER A_BI
PASSWORD = '***'
LOGIN_NAME = A_BI
DISPLAY_NAME = A_BI
MUST_CHANGE_PASSWORD = FALSE
DEFAULT_WAREHOUSE = A_WDB
DEFAULT_ROLE = READ_ROLE
COMMENT = 'SELECT';
CREATE OR REPLACE USER A_WEB
PASSWORD = '***'
LOGIN_NAME = A_WEB
DISPLAY_NAME = A_WEB
MUST_CHANGE_PASSWORD = FALSE
DEFAULT_WAREHOUSE = A_WDB
DEFAULT_ROLE = READ_ROLE
COMMENT = 'SELECT';
-- GRANT
GRANT USAGE ON WAREHOUSE A_WH TO ROLE READ_ROLE;
GRANT USAGE ON WAREHOUSE A_WH TO ROLE CRUD_ROLE;
GRANT USAGE ON WAREHOUSE A_WH TO ROLE OBJECT_ROLE;
GRANT USAGE ON DATABASE A_WDB TO ROLE READ_ROLE;
GRANT USAGE ON DATABASE A_WDB TO ROLE CRUD_ROLE;
GRANT USAGE ON DATABASE A_WDB TO ROLE OBJECT_ROLE;
GRANT USAGE ON SCHEMA A_WDB.ODS TO ROLE CRUD_ROLE;
GRANT USAGE ON SCHEMA A_WDB.ODS TO ROLE OBJECT_ROLE;
GRANT USAGE ON SCHEMA A_WDB.DW TO ROLE CRUD_ROLE;
GRANT USAGE ON SCHEMA A_WDB.DW TO ROLE READ_ROLE;
GRANT USAGE ON SCHEMA A_WDB.DW TO ROLE OBJECT_ROLE;
GRANT USAGE ON SCHEMA A_WDB.DM TO ROLE CRUD_ROLE;
GRANT USAGE ON SCHEMA A_WDB.DM TO ROLE READ_ROLE;
GRANT USAGE ON SCHEMA A_WDB.DM TO ROLE OBJECT_ROLE;
GRANT OWNERSHIP ON ALL TABLES IN SCHEMA A_WDB.ODS TO ROLE OBJECT_ROLE;
GRANT OWNERSHIP ON ALL TABLES IN SCHEMA A_WDB.DW TO ROLE OBJECT_ROLE;
GRANT OWNERSHIP ON ALL TABLES IN SCHEMA A_WDB.DM TO ROLE OBJECT_ROLE;
GRANT SELECT, INSERT, UPDATE, TRUNCATE, DELETE, REFERENCES ON ALL TABLES IN SCHEMA A_WDB.ODS TO ROLE CRUD_ROLE;
GRANT SELECT, INSERT, UPDATE, TRUNCATE, DELETE, REFERENCES ON ALL TABLES IN SCHEMA A_WDB.DW TO ROLE CRUD_ROLE;
GRANT SELECT, INSERT, UPDATE, TRUNCATE, DELETE, REFERENCES ON ALL TABLES IN SCHEMA A_WDB.DM TO ROLE CRUD_ROLE;
GRANT SELECT ON ALL TABLES IN SCHEMA A_WDB.ODS TO ROLE READ_ROLE;
GRANT SELECT ON ALL TABLES IN SCHEMA A_WDB.DW TO ROLE READ_ROLE;
GRANT SELECT ON ALL TABLES IN SCHEMA A_WDB.DM TO ROLE READ_ROLE;
GRANT ROLE READ_ROLE TO USER A_WEB;
GRANT ROLE READ_ROLE TO USER A_BI;
GRANT ROLE CRUD_ROLE TO USER A_ETL;
GRANT ROLE OBJECT_ROLE TO USER A_DBA;
'개발노트 > 데이터베이스' 카테고리의 다른 글
snowflake Numeric value 'string_value' is not recognized. 에러 발생이유 (0) | 2022.05.09 |
---|---|
snowflake에 insert시 .0이 붙는 문제 해결 과정 (0) | 2022.04.26 |
centos에서 pip install mysqlclient설치시 에러 해결방안 (0) | 2021.12.21 |
sqlalchemy.exc.OperationalError: (mariadb.OperationalError) Unknown server host '@ip_address' (0) | 2021.10.21 |
MYSQL 접속시 public key retrieval is not allowed 에러 해결방법 (0) | 2021.10.21 |
Comments