1
2
CREATE DATABASE <DATABASE NAME>;
3
CREATE USER <USER> PASSWORD <PASSWORD IN QUOTES>;
4
*/
5
6
7
GRANT CREATE, TEMPORARY ON DATABASE <DATABASE NAME> TO <USER>;
8
GRANT USAGE ON SCHEMA <SCHEMA NAME> TO <USER>;
9
GRANT SELECT, INSERT, UPDATE, DELETE ON TABLE <SCHEMA NAME>.klaviyo_event TO <USER>;
10
GRANT SELECT, INSERT, UPDATE, DELETE ON TABLE <SCHEMA NAME>.klaviyo_profile TO <USER>;
11
GRANT SELECT, INSERT, UPDATE, DELETE ON TABLE <SCHEMA NAME>.klaviyo_metric TO <USER>;
12
13
create table klaviyo_profile (
14
id varchar(32) not null,
15
external_id varchar(255),
16
email varchar(255),
17
phone_number varchar(255),
18
first_name varchar(255),
19
last_name varchar(255),
20
title varchar(255),
21
organization varchar(255),
22
properties super,
23
image varchar(255),
24
created timestamp,
25
updated timestamp,
26
location_address1 varchar(255),
27
location_address2 varchar(255),
28
location_city varchar(255),
29
location_country varchar(255),
30
location_latitude varchar(255),
31
location_longitude varchar(255),
32
location_region varchar(255),
33
location_zip varchar(255),
34
primary key (id)
35
);
36
create table klaviyo_event (
37
id varchar(32) not null,
38
metric_id varchar(255) not null,
39
profile_id varchar(255),
40
event_properties super,
41
datetime datetime,
42
uuid varchar(255),
43
primary key (id)
44
);
45
create table klaviyo_metric (
46
id varchar(6) not null,
47
name varchar(255) not null,
48
integration_id varchar(50) not null,
49
integration_name varchar(255) not null,
50
integration_category varchar(255) not null,
51
created datetime,
52
updated datetime,
53
primary key (id)
54
);
55