-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcassandra-sink.cql
More file actions
112 lines (93 loc) · 2.11 KB
/
cassandra-sink.cql
File metadata and controls
112 lines (93 loc) · 2.11 KB
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
//******* Création de la base de données, des types et des tables
// ********* KEYSPACE *********
CREATE KEYSPACE sink WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '1'} AND durable_writes = true ;
USE sink ;
// ********* TYPES *********
------- Types pour les objets 'album', 'added_by' et 'video_thumbnail' -------
CREATE TYPE IF NOT EXISTS udt_vidthumbnail (url text) ;
CREATE TYPE IF NOT EXISTS udt_artists
(
external_urls map<text,text>,
href text,
id text,
name text,
type text,
uri text
) ;
CREATE TYPE IF NOT EXISTS udt_added_by
(
external_urls map<text,text>,
href text,
id text,
type text,
uri text
) ;
CREATE TYPE IF NOT EXISTS udt_images
(
height smallint,
url text,
width smallint
) ;
CREATE TYPE IF NOT EXISTS udt_album
(
album_type text,
artists frozen<set<udt_artists>>,
available_markets set<text>,
external_urls map<text,text>,
href text,
id text,
images frozen<set <udt_images>>,
name text,
release_date date,
release_date_precision text,
total_tracks smallint,
type text,
uri text
) ;
CREATE TYPE IF NOT EXISTS udt_tracks_track
(
album frozen<udt_album>,
artists frozen<set<udt_artists>>,
available_markets set<text>,
disc_number smallint,
duration_ms int,
episode boolean,
explicit boolean,
external_ids map<text,text>,
external_urls map<text,text>,
href text,
id text,
is_local boolean,
name text,
popularity smallint,
preview_url text,
track boolean,
track_number smallint,
type text,
uri text
) ;
CREATE TYPE IF NOT EXISTS udt_tracks
(
added_at timestamp,
added_by frozen<udt_added_by>,
is_local boolean,
primary_color text,
track frozen<udt_tracks_track>,
video_thumbnail frozen<udt_vidthumbnail>
) ;
// ********* TABLE *********
CREATE TABLE IF NOT EXISTS spotify_playlist
(
collaborative boolean,
description text,
followers int,
id text,
name text,
nbtracks smallint,
owner text,
public boolean,
snapshot_id text,
tracks frozen<set<udt_tracks>>,
uri text,
PRIMARY KEY (id)
) ;