Skip to content

Instantly share code, notes, and snippets.

Scott Hoover githoov

Block or report user

Report or block githoov

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:1150a9afc5b3f4b1a138
- base_view: cohorts
always_filter:
event_date: 'this week'
type: activity, user
- view: cohorts
derived_table:
sql: |
SELECT 'activity' AS type
, user_id
@githoov
githoov / gist:02057029962363eb6167
Created Sep 5, 2014
Interquartile Rule for Outliers
View gist:02057029962363eb6167
- view: outlier
derived_table:
sql: |
SELECT (PERCENTILE_DISC(0.75) WITHIN GROUP(ORDER BY days_between_posts) OVER()
+ (PERCENTILE_DISC(0.75) WITHIN GROUP(ORDER BY days_between_posts) OVER()
- PERCENTILE_DISC(0.25) WITHIN GROUP(ORDER BY days_between_posts) OVER()) * 1.5)::INT AS cutoff
FROM ${consumer_posts.SQL_TABLE_NAME} AS consumer_posts
LIMIT 1
sql_trigger_value: SELECT CURRENT_DATE
sortkeys: [cutoff]
@githoov
githoov / gist:c0122dfaafaf5fdd1804
Last active Aug 29, 2015
production_vs_development_derived_tables
View gist:c0122dfaafaf5fdd1804

Quite often it's beneficial to place a restriction on an SQL query while proptyping/testing a transformation. To make this a bit easier, one has the ability to place an in-line comment within a derived table to place a restriction while in developer mode, and, once the derived table is pushed, have it not apply or simply differ in some way.

In the following example, I would like to do a funnel analysis, but limit this transformation to the past 30 days while in developer mode. No resitriction exists once pushed to production.

- view: funnel
  derived_table:
    sql: |
      SELECT user_id
        , COUNT(*) AS lifetime_events
View gist:942cc3addc82813790ed
- view: day_sequence
derived_table:
sql: |
SELECT DATE(DATE_ADD('2010-01-01', INTERVAL @i := @i + 1 day)) AS series
FROM orders, (SELECT @i := 0) AS i_table
WHERE @i < DATEDIFF(CURDATE(), '2010-01-01') + 1
sql_trigger_value: SELECT CURDATE()
indexes: [series]
fields:
View south_africa.topo.json
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View output.json
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@githoov
githoov / gist:c7fdc8904ffd24ae6b34
Created May 26, 2015
Custom JS Visualizations
View gist:c7fdc8904ffd24ae6b34

#Custom Visualization Framework

##The Basics

View finance.yml
# PRELIMINARIES #
- connection: meta
- scoping: true # for backward compatibility
- include: "dwh.mrr.view.lookml"
- include: "dwh.mrr_planned.view.lookml"
- include: "dwh.account.view.lookml"
- include: "dwh.account_facts.view.lookml"
- include: "dwh.opportunity.view.lookml"
- include: "dwh.opportunity_actualized.view.lookml"
@githoov
githoov / config.yml
Created Oct 20, 2015
Snowplow Config
View config.yml
aws:
access_key_id: my_id
secret_access_key: my_key
s3:
region: us-east-1
buckets:
assets: s3://snowplow-hosted-assets # DO NOT CHANGE unless you are hosting the jarfiles etc yourself in your own bucket
jsonpath_assets: s3://snowplow-looker/jsonpaths
log: s3n://snowplow-looker-emr-log/
raw:
@githoov
githoov / survival.model.lookml
Last active Dec 29, 2015
LookML to Generate Example Looker Model
View survival.model.lookml
# preliminaries #
- connection: [your_database_connection]
- scoping: true
- case_sensitive: false
# views to explore #
- explore: payments
You can’t perform that action at this time.