Created
January 7, 2016 21:21
-
-
Save githoov/72b143faa3fcfe108551 to your computer and use it in GitHub Desktop.
Redshift Recent Data Loads
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- explore: data_loads | |
hidden: true | |
- view: data_loads | |
derived_table: | |
sql: | | |
select replace(regexp_substr(filename, '//[a-zA-Z0-9\-]+/'), '/', '') as root_bucket | |
, case | |
when replace(regexp_substr(filename, '//[a-zA-Z0-9\-]+/'), '/', '') = 'snowplow-looker-emr-out' | |
then 'snowplow' | |
else regexp_replace(regexp_substr(filename, '/[a-zA-Z0-9\\-\\_]+\\.[a-zA-Z]{3,4}'), '(/|[0-9]{2,})', '') | |
end as file_name | |
, max(curtime) as most_recent_load | |
from stl_load_commits | |
group by 1,2 | |
fields: | |
- dimension: root_bucket | |
type: string | |
sql: ${TABLE}.root_bucket | |
- dimension: file_name | |
type: string | |
sql: ${TABLE}.file_name | |
- dimension_group: most_recent_load | |
type: time | |
timeframes: [time, date] | |
sql: ${TABLE}.most_recent_load | |
- dimension: hours_since_last_load | |
type: int | |
sql: datediff('hour', ${TABLE}.most_recent_load, getdate()) | |
html: | | |
{% if value < 24 %} | |
<div style="color:#B40404; background-color:#22CE7E; font-size:100%; text-align:center">{{ rendered_value }}</div> | |
{% elsif value >= 24 and value < 48 %} | |
<div style="color:#868A08; background-color:#95F047; font-size:100%; text-align:center">{{ rendered_value }}</div> | |
{% elsif value >= 48 %} | |
<div style="color:#868A08; background-color:#C64646; font-size:100%; text-align:center">{{ rendered_value }}</div> | |
{% endif %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment