forked from tulski-s/full_stack_de
-
Notifications
You must be signed in to change notification settings - Fork 0
/
manual_init.sql
44 lines (33 loc) · 1.08 KB
/
manual_init.sql
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/* for OceanRecords operational database */
-- create user
CREATE USER "os_admin" WITH PASSWORD 'getme';
ALTER USER "os_admin" WITH LOGIN;
ALTER USER "os_admin" WITH SUPERUSER;
-- create database
DROP DATABASE IF EXISTS oceanrecords;
CREATE DATABASE oceanrecords;
-- create schema
DROP SCHEMA IF EXISTS os;
CREATE SCHEMA os;
/* for OceanRecords DWH */
CREATE USER "etl_usr" WITH PASSWORD 'meget';
ALTER USER "etl_usr" WITH LOGIN;
ALTER USER "etl_usr" WITH SUPERUSER;
CREATE USER "superset_usr" WITH PASSWORD 'sohard';
ALTER USER "superset_usr" WITH LOGIN;
GRANT USAGE ON SCHEMA dwh TO "superset_usr";
GRANT SELECT ON ALL TABLES IN SCHEMA dwh TO "superset_usr";
DROP SCHEMA IF EXISTS stage CASCADE;
CREATE SCHEMA stage;
DROP SCHEMA IF EXISTS work CASCADE;
CREATE SCHEMA work;
DROP SCHEMA IF EXISTS dwh CASCADE;
CREATE SCHEMA dwh;
DROP SCHEMA IF EXISTS etl_control CASCADE;
CREATE SCHEMA etl_control;
/* for Airflow */
DROP DATABASE IF EXISTS airflow;
CREATE DATABASE airflow;
CREATE USER "airflow" WITH PASSWORD 'airflow';
ALTER USER "airflow" WITH LOGIN;
ALTER USER "airflow" WITH SUPERUSER;