This repository has been archived by the owner on Feb 28, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
adcreative.view.lkml
314 lines (259 loc) · 6.7 KB
/
adcreative.view.lkml
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
include: "ad.view"
include: "adset.view"
explore: adcreative_nested_joins_base {
extension: required
join: adcreative_object_story_spec {
view_label: "Adcreative: Object Story Spec"
sql_on: ${adcreative.id} = ${adcreative_object_story_spec.id};;
relationship: one_to_one
}
}
explore: adcreative_fb_adapter {
persist_with: facebook_ads_etl_datagroup
view_name: adcreative
from: adcreative_fb_adapter
extends: [adcreative_nested_joins_base]
hidden: yes
join: ad {
from: fb_ad
type: left_outer
sql_on: ${ad.creative_id} = ${adcreative.id} ;;
relationship: one_to_one
}
join: adset {
from: fb_adset
type: left_outer
sql_on: ${ad.adset_id} = ${adset.id} ;;
relationship: many_to_one
}
join: campaign {
from: fb_campaign
type: left_outer
sql_on: ${ad.campaign_id} = ${campaign.id} ;;
relationship: many_to_one
}
join: account {
from: fb_account
type: left_outer
sql_on: '1' = ${account.id} ;;
relationship: many_to_one
}
}
view: adcreative_fb_adapter {
extends: [stitch_base, facebook_ads_config]
# sql_table_name: {{ facebook_ads_schema._sql }}.facebook_adcreative_{{ facebook_account_id._sql }} ;;
sql_table_name: (
SELECT adcreative.*
FROM {{ facebook_ads_schema._sql }}.facebook_adcreative_{{ facebook_account_id._sql }} AS adcreative
INNER JOIN (
SELECT
MAX(_sdc_sequence) AS seq
, id
FROM {{ facebook_ads_schema._sql }}.facebook_adcreative_{{ facebook_account_id._sql }}
GROUP BY id
) AS max_adcreative
ON adcreative.id = max_adcreative.id
AND adcreative._sdc_sequence = max_adcreative.seq
) ;;
dimension: id {
hidden: yes
primary_key: yes
type: string
}
dimension: account_id {
hidden: yes
type: string
}
dimension: body {
type: string
}
dimension: call_to_action_type {
type: string
}
dimension: effective_instagram_story_id {
hidden: yes
type: string
}
dimension: effective_object_story_id {
hidden: yes
type: string
}
dimension: image_hash {
hidden: yes
type: string
}
dimension: image_url {
hidden: yes
type: string
html: "<img src='{{value}}' />" ;;
}
dimension: instagram_actor_id {
type: string
hidden: yes
}
dimension: instagram_permalink_url {
hidden: yes
type: string
}
dimension: name {
type: string
}
dimension: object_story_id {
hidden: yes
type: string
}
dimension: object_story_spec {
hidden: yes
}
dimension: object_type {
type: string
}
dimension: status {
type: string
hidden: yes
}
dimension: status_active {
type: yesno
sql: ${status} = 'ACTIVE' ;;
}
dimension: thumbnail_url {
type: string
html: "<img src='{{value}}' />" ;;
}
dimension: title {
type: string
}
dimension: video_id {
type: string
hidden: yes
}
}
view: adcreative_object_story_spec {
extends: [stitch_base, facebook_ads_config]
derived_table: {
sql:
SELECT
adcreative.id as id,
adcreative._sdc_batched_at,
adcreative._sdc_received_at,
adcreative._sdc_sequence,
adcreative._sdc_table_version,
adcreative.object_story_spec__instagram_actor_id as instagram_actor_id,
adcreative.object_story_spec__page_id as page_id,
adcreative.object_story_spec__video_data__call_to_action__type as video_data_call_to_action_type,
adcreative.object_story_spec__link_data__call_to_action__type as link_data_call_to_action_type,
adcreative.object_story_spec__video_data__call_to_action__value__link as video_data_call_to_action_link,
adcreative.object_story_spec__video_data__call_to_action__value__link_caption as video_data_call_to_action_link_caption,
adcreative.object_story_spec__video_data__image_hash as video_data__image_hash,
adcreative.object_story_spec__video_data__image_url as video_data__image_url,
adcreative.object_story_spec__video_data__video_id as video_data__video_id,
adcreative.object_story_spec__video_data__description as video_data__description,
adcreative.object_story_spec__link_data__name as link_data_name,
adcreative.object_story_spec__link_data__message as link_data_message,
adcreative.object_story_spec__link_data__link as link_data_link,
adcreative.object_story_spec__link_data__image_hash as link_data_image_hash,
adcreative.object_story_spec__link_data__description as link_data_description,
adcreative.object_story_spec__link_data__caption as link_data_caption
adcreative.object_story_spec__link_data__picture as link_data_picture
adcreative.object_story_spec__link_data__attachment_style as link_data_attachment_style
FROM
{{ facebook_ads_schema._sql }}.facebook_adcreative_{{ facebook_account_id._sql }} as adcreative
;;
}
dimension: instagram_actor_id {
hidden: yes
type: string
}
dimension: id {
hidden: yes
type: string
}
dimension: page_id {
hidden: yes
type: string
}
dimension: video_data_call_to_action_type {
hidden: yes
type: string
}
dimension: link_data_call_to_action_type {
hidden: yes
type: string
}
dimension: video_data_call_to_action_link {
hidden: yes
type: string
}
dimension: video_data_call_to_action_link_caption {
hidden: yes
type: string
}
dimension: video_data_call_to_action_link_format {
hidden: yes
type: string
sql: 'NA'::text ;;
}
dimension: video_data__image_hash {
hidden: yes
type: string
}
dimension: video_data__image_url {
hidden: yes
type: string
}
dimension: video_data__video_id {
hidden: yes
type: string
}
dimension: video_data__description {
hidden: yes
type: string
}
dimension: video_data__call_to_action_lead_gen_form_id {
hidden: yes
type: string
sql: 'NA'::text ;;
}
dimension: video_data_message {
hidden: yes
type: string
sql: 'NA'::text ;;
}
dimension: video_data_title {
hidden: yes
type: string
sql: 'NA'::text ;;
}
dimension: link_data_name {
hidden: yes
type: string
}
dimension: link_data_message {
hidden: yes
type: string
}
dimension: link_data_link {
hidden: yes
type: string
}
dimension: link_data_image_hash {
hidden: yes
type: string
}
dimension: link_data_description {
hidden: yes
type: string
}
dimension: link_data_caption {
hidden: yes
type: string
}
dimension: link_data_picture {
hidden: yes
type: string
}
dimension: link_data_attachment_style {
hidden: yes
type: string
}
}