-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvmapi_jpc_facts.view.lkml
64 lines (56 loc) · 1.81 KB
/
vmapi_jpc_facts.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
view: vmapi_jpc_facts {
derived_table: {
sql:
SELECT
CONCAT( ufds.company, '(',ufds.login,')') AS "customer_display_name",
ufds.uuid AS "ufds_uuid",
vmapi.uuid AS "vmapi_uuid",
DATE_PART('day',(DATE(MAX(vmapi.date) ))::TIMESTAMP - (DATE(MIN(vmapi.date) ))::TIMESTAMP ) AS "run_duration",
DATE(MIN(vmapi.date) ) AS "first_reported_date",
DATE(MAX(vmapi.date) ) AS "last_reported_date"
FROM smartdc.vmapi AS vmapi
LEFT JOIN smartdc.ufds AS ufds ON ufds.uuid=vmapi.owner_uuid
FULL OUTER JOIN smartdc.datacenters AS datacenters ON datacenters.name = vmapi.datacenter
WHERE (ufds.email NOT LIKE '%joyent.com%' OR ufds.email IS NULL) AND (((datacenters."group") = 'JPC'))
GROUP BY 1,2,3
ORDER BY 4 DESC
;;
}
dimension: vmapi_uuid {
description: "UUID of the instance VMapi.uuid"
type: string
primary_key: yes
sql: ${TABLE}.vmapi_uuid ;;
}
dimension: ufds_uuid {
description: "account owner UFDS.uuid of this instance"
type: string
sql: ${TABLE}.ufds_uuid ;;
}
dimension_group: last_reported_date {
description: "The last reported date of this instance"
type: time
timeframes: [date, week, month]
sql: ${TABLE}.last_reported_date ;;
}
dimension_group: first_reported_date {
description: "The first reported date of this instance"
type: time
timeframes: [date, week, month]
sql: ${TABLE}.first_reported_date ;;
}
dimension: run_duration {
description: "the number of days this instance had been running"
type: number
sql: ${TABLE}.run_duration ;;
}
measure: count {
description: "Number of distinct objects returned in query"
type: count
}
measure: durations {
description: "The sum if the durations"
type: sum
sql: ${run_duration};;
}
}