├── iowa ├── .gitkeep ├── iowa.model.lkml └── iowa.view.lkml ├── affinity └── .gitkeep ├── bridge ├── .gitkeep ├── bridge_united │ ├── .gitkeep │ ├── devices.view.lkml │ ├── users.view.lkml │ ├── products.view.lkml │ ├── fulfillers.view.lkml │ ├── order_product.view.lkml │ └── orders.view.lkml ├── derived_views │ ├── .gitkeep │ └── products.view.lkml ├── retail_retailstoregroupthrough.view.lkml ├── vendor_drinktag.view.lkml ├── vendor_drinkproducer.view.lkml ├── notifications_fcmdevice.view.lkml ├── api_winery.view.lkml ├── vendor_drinkinventory.view.lkml ├── api_varietal.view.lkml ├── retail_retailgroup.view.lkml ├── retail_store.view.lkml ├── vendor_drink.view.lkml ├── order_orderproduct.view.lkml ├── tipsi_auth_user.view.lkml ├── retail_retailinventory.view.lkml ├── bridge.explore.view.lkml ├── order_order.view.lkml ├── core_restaurant.view.lkml └── api_winetbl.view.lkml ├── drync ├── .gitkeep ├── drync_united │ ├── .gitkeep │ ├── devices.view.lkml │ ├── users.view.lkml │ ├── fulfillers.view.lkml │ ├── products.view.lkml │ ├── order_product.view.lkml │ └── orders.view.lkml ├── order_products.view.lkml ├── order_percentage.view.lkml ├── order_items_base_drync.view.lkml ├── app_registrations.view.lkml ├── apps.view.lkml ├── users.view.lkml ├── devices.view.lkml ├── app_sessions.view.lkml ├── organizations.view.lkml ├── products.view.lkml ├── product_clicked.view.lkml ├── line_items.view.lkml ├── shipments.view.lkml ├── payments.view.lkml ├── retailer_bottle_sources.view.lkml └── drync.explore.view.lkml ├── throtle ├── .gitkeep └── attributes.view.lkml ├── tipsi ├── .gitkeep ├── derived_views │ ├── .gitkeep │ └── products.view.lkml ├── tipsi_united │ ├── .gitkeep │ ├── devices.view.lkml │ ├── users.view.lkml │ ├── products.view.lkml │ ├── fulfillers.view.lkml │ ├── order_product.view.lkml │ └── orders.view.lkml ├── views │ ├── vendor_drinksourceurl.view.lkml │ ├── api_winescoring.view.lkml │ ├── tipsi_auth_user_groups.view.lkml │ ├── retail_retailstoregroupthrough.view.lkml │ ├── retail_retailgroupsetting.view.lkml │ ├── vendor_drinktag.view.lkml │ ├── vendor_drinkproducer.view.lkml │ ├── retail_retailgroup.view.lkml │ ├── api_winescoringvintagetbl.view.lkml │ ├── api_winery.view.lkml │ ├── notifications_fcmdevice.view.lkml │ ├── api_vineyard.view.lkml │ ├── retail_categoryitem.view.lkml │ ├── vendor_drinkinventory.view.lkml │ ├── api_varietal.view.lkml │ ├── api_region.view.lkml │ ├── api_subregion.view.lkml │ ├── api_country.view.lkml │ ├── retail_store.view.lkml │ ├── vendor_drink.view.lkml │ ├── retail_category.view.lkml │ ├── order_orderproduct.view.lkml │ ├── order_order.view.lkml │ ├── tipsi_auth_user.view.lkml │ ├── retail_retailinventory.view.lkml │ ├── core_restaurant.view.lkml │ └── api_winetbl.view.lkml └── tipsi.explore.view.lkml └── united ├── .gitkeep ├── _config.view.lkml ├── devices.view.lkml ├── fulfillers.view.lkml ├── products.view.lkml ├── users.view.lkml ├── united.model.lkml ├── orders.view.lkml └── order_product.view.lkml /iowa/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /affinity/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /bridge/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /drync/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /throtle/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tipsi/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /united/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /drync/drync_united/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tipsi/derived_views/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tipsi/tipsi_united/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /bridge/bridge_united/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /bridge/derived_views/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /united/_config.view.lkml: -------------------------------------------------------------------------------- 1 | datagroup: bridge_default { 2 | sql_trigger: select count(*) from production.production.line_items ;; 3 | max_cache_age: "720 hours" 4 | } 5 | 6 | persist_with: bridge_default 7 | -------------------------------------------------------------------------------- /iowa/iowa.model.lkml: -------------------------------------------------------------------------------- 1 | connection: "warehouse" 2 | 3 | include: "iowa.view.lkml" 4 | 5 | datagroup: iowa_default_datagroup { 6 | # sql_trigger: SELECT MAX(invoice_id) FROM iowa;; 7 | max_cache_age: "1 hour" 8 | } 9 | 10 | persist_with: iowa_default_datagroup 11 | 12 | explore: iowa { 13 | view_name: iowa 14 | view_label: "Iowa Data Explore" 15 | } 16 | -------------------------------------------------------------------------------- /tipsi/tipsi_united/devices.view.lkml: -------------------------------------------------------------------------------- 1 | view: devices_tipsi_united { 2 | derived_table: { 3 | explore_source: devices_tipsi { 4 | column: device_id {} 5 | column: user_id {} 6 | derived_column: source { 7 | sql: 'tipsi' ;; 8 | } 9 | } 10 | } 11 | dimension: device_id {} 12 | dimension: user_id {} 13 | dimension: source { 14 | type: string 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /drync/drync_united/devices.view.lkml: -------------------------------------------------------------------------------- 1 | view: devices_drync_united { 2 | derived_table: { 3 | explore_source: devices_drync { 4 | column: device_id { field: devices_drync.device_identifier } 5 | column: user_id {} 6 | derived_column: source { 7 | sql: 'drync' ;; 8 | } 9 | } 10 | } 11 | 12 | dimension: device_id {} 13 | dimension: user_id {} 14 | dimension: source { 15 | type: string 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /bridge/bridge_united/devices.view.lkml: -------------------------------------------------------------------------------- 1 | 2 | view: devices_bridge_united { 3 | derived_table: { 4 | explore_source: devices_bridge { 5 | column: device_id {} 6 | column: user_id {} 7 | derived_column: source { 8 | sql: 'bridge' ;; 9 | } 10 | } 11 | } 12 | dimension: id { 13 | type: number 14 | } 15 | dimension: device_id {} 16 | dimension: user_id {} 17 | dimension: source { 18 | type: string 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /tipsi/views/vendor_drinksourceurl.view.lkml: -------------------------------------------------------------------------------- 1 | view: vendor_drinksourceurl { 2 | sql_table_name: TIPSI.PUBLIC.VENDOR_DRINKSOURCEURL ;; 3 | drill_fields: [id] 4 | 5 | dimension: id { 6 | primary_key: yes 7 | type: number 8 | sql: ${TABLE}."ID" ;; 9 | } 10 | 11 | dimension: drink_id { 12 | type: number 13 | sql: ${TABLE}."DRINK_ID" ;; 14 | } 15 | 16 | dimension: url { 17 | type: string 18 | sql: ${TABLE}."URL" ;; 19 | } 20 | 21 | measure: count { 22 | type: count 23 | drill_fields: [id] 24 | } 25 | } -------------------------------------------------------------------------------- /tipsi/views/api_winescoring.view.lkml: -------------------------------------------------------------------------------- 1 | view: api_winescoring { 2 | sql_table_name: TIPSI.PUBLIC.API_WINESCORING ;; 3 | drill_fields: [id] 4 | 5 | dimension: id { 6 | primary_key: yes 7 | type: number 8 | sql: ${TABLE}."ID" ;; 9 | } 10 | 11 | dimension: vintage_scoring { 12 | type: number 13 | sql: ${TABLE}."VINTAGE_SCORING" ;; 14 | } 15 | 16 | dimension: wine_id { 17 | type: number 18 | sql: ${TABLE}."WINE_ID" ;; 19 | } 20 | 21 | measure: count { 22 | type: count 23 | drill_fields: [id] 24 | } 25 | } -------------------------------------------------------------------------------- /tipsi/views/tipsi_auth_user_groups.view.lkml: -------------------------------------------------------------------------------- 1 | view: tipsi_auth_user_groups { 2 | sql_table_name: TIPSI.PUBLIC.TIPSI_AUTH_USER_GROUPS ;; 3 | drill_fields: [id] 4 | 5 | dimension: id { 6 | primary_key: yes 7 | type: number 8 | sql: ${TABLE}."ID" ;; 9 | } 10 | 11 | dimension: group_id { 12 | type: number 13 | sql: ${TABLE}."GROUP_ID" ;; 14 | } 15 | 16 | dimension: user_id { 17 | type: number 18 | sql: ${TABLE}."USER_ID" ;; 19 | } 20 | 21 | measure: count { 22 | type: count 23 | drill_fields: [id] 24 | } 25 | } -------------------------------------------------------------------------------- /tipsi/views/retail_retailstoregroupthrough.view.lkml: -------------------------------------------------------------------------------- 1 | view: retail_retailstoregroupthrough { 2 | sql_table_name: TIPSI.PUBLIC.RETAIL_RETAILSTOREGROUPTHROUGH ;; 3 | drill_fields: [id] 4 | 5 | dimension: id { 6 | primary_key: yes 7 | type: number 8 | sql: ${TABLE}."ID" ;; 9 | } 10 | 11 | dimension: group_id { 12 | type: number 13 | sql: ${TABLE}."GROUP_ID" ;; 14 | } 15 | 16 | dimension: store_id { 17 | type: number 18 | sql: ${TABLE}."STORE_ID" ;; 19 | } 20 | 21 | measure: count { 22 | type: count 23 | drill_fields: [id] 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /drync/order_products.view.lkml: -------------------------------------------------------------------------------- 1 | view: order_products { 2 | sql_table_name: production.production.line_items ;; 3 | 4 | dimension: id { 5 | primary_key: yes 6 | hidden: yes 7 | type: number 8 | sql: ${TABLE}.id ;; 9 | } 10 | 11 | dimension: bottle_id { 12 | type: number 13 | sql: ${TABLE}.bottle_id ;; 14 | } 15 | 16 | dimension: shipment_id { 17 | type: number 18 | sql: ${TABLE}.shipment_id ;; 19 | } 20 | 21 | dimension: price_per_bottle { 22 | type: number 23 | sql: ${TABLE}.price_per_bottle /100 ;; 24 | value_format_name: usd 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /drync/drync_united/users.view.lkml: -------------------------------------------------------------------------------- 1 | include: "../../united/users.view" 2 | 3 | view: users_drync_united { 4 | extends: [users_fields] 5 | derived_table: { 6 | explore_source: users_drync { 7 | column: id {} 8 | column: email {} 9 | column: first_name {} 10 | column: last_name {} 11 | column: birth_year {} 12 | column: gender {field: users_drync.gender_for_ndt} 13 | column: age {} 14 | column: state {} 15 | column: zipcode {} 16 | column: country {} 17 | derived_column: source { 18 | sql: 'drync' ;; 19 | } 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /tipsi/views/retail_retailgroupsetting.view.lkml: -------------------------------------------------------------------------------- 1 | view: retail_retailgroupsetting { 2 | sql_table_name: TIPSI.PUBLIC.RETAIL_RETAILGROUPSETTING ;; 3 | drill_fields: [id] 4 | 5 | dimension: id { 6 | primary_key: yes 7 | type: number 8 | sql: ${TABLE}."ID" ;; 9 | } 10 | 11 | dimension: group_id { 12 | type: number 13 | sql: ${TABLE}."GROUP_ID" ;; 14 | } 15 | 16 | dimension: setting { 17 | type: number 18 | sql: ${TABLE}."SETTING" ;; 19 | } 20 | 21 | dimension: value { 22 | type: string 23 | sql: ${TABLE}."VALUE" ;; 24 | } 25 | 26 | measure: count { 27 | type: count 28 | drill_fields: [id] 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /tipsi/views/vendor_drinktag.view.lkml: -------------------------------------------------------------------------------- 1 | view: vendor_drinktag { 2 | sql_table_name: TIPSI.PUBLIC.VENDOR_DRINKTAG ;; 3 | drill_fields: [id] 4 | 5 | dimension: id { 6 | primary_key: yes 7 | type: number 8 | sql: ${TABLE}."ID" ;; 9 | } 10 | 11 | dimension: drink_type { 12 | type: number 13 | sql: ${TABLE}."DRINK_TYPE" ;; 14 | } 15 | 16 | dimension: name { 17 | type: string 18 | sql: ${TABLE}."NAME" ;; 19 | } 20 | 21 | dimension: parent_type { 22 | type: number 23 | sql: ${TABLE}."PARENT_TYPE" ;; 24 | } 25 | 26 | dimension: validated { 27 | type: yesno 28 | sql: ${TABLE}."VALIDATED" ;; 29 | } 30 | 31 | measure: count { 32 | type: count 33 | drill_fields: [id, name] 34 | } 35 | } -------------------------------------------------------------------------------- /drync/drync_united/fulfillers.view.lkml: -------------------------------------------------------------------------------- 1 | view: fulfillers_drync_united { 2 | derived_table: { 3 | explore_source: fulfillers_drync { 4 | column: fulfiller_id {field: fulfillers.id} 5 | column: fulfiller_name {field: fulfillers.name} 6 | column: organization_id {field: fulfillers.organization_id} 7 | column: organization_name {field:organizations.name} 8 | column: organization_short_name {field:organizations.short_name} 9 | derived_column: source { 10 | sql: 'drync' ;; 11 | } 12 | } 13 | } 14 | dimension: fulfiller_id {} 15 | dimension: fulfiller_name {} 16 | dimension: organization_id {} 17 | dimension: organization_name {} 18 | dimension: source { 19 | type: string 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /tipsi/tipsi_united/users.view.lkml: -------------------------------------------------------------------------------- 1 | include: "../../united/users.view" 2 | 3 | view: users_tipsi_united { 4 | extends: [users_fields] 5 | derived_table: { 6 | explore_source: users_tipsi { 7 | column: id {} 8 | column: email {} 9 | column: first_name {} 10 | column: last_name {} 11 | column: birth_year { field: users_tipsi.birth_year_number } 12 | column: gender {} 13 | column: age {} 14 | derived_column: state { 15 | sql: null ;; 16 | } 17 | derived_column: zipcode { 18 | sql: null ;; 19 | } 20 | derived_column: country { 21 | sql: null ;; 22 | } 23 | derived_column: source { 24 | sql: 'tipsi' ;; 25 | } 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /bridge/bridge_united/users.view.lkml: -------------------------------------------------------------------------------- 1 | include: "../../united/users.view" 2 | 3 | view: users_bridge_united { 4 | extends: [users_fields] 5 | derived_table: { 6 | explore_source: users_bridge { 7 | column: id {} 8 | column: email {} 9 | column: first_name {} 10 | column: last_name {} 11 | column: birth_year { field: users_bridge.birth_year_number } 12 | column: gender {} 13 | column: age {} 14 | derived_column: state { 15 | sql: null ;; 16 | } 17 | derived_column: zipcode { 18 | sql: null ;; 19 | } 20 | derived_column: country { 21 | sql: null ;; 22 | } 23 | derived_column: source { 24 | sql: 'bridge' ;; 25 | } 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /tipsi/views/vendor_drinkproducer.view.lkml: -------------------------------------------------------------------------------- 1 | view: vendor_drinkproducer { 2 | sql_table_name: TIPSI.PUBLIC.VENDOR_DRINKPRODUCER ;; 3 | drill_fields: [id] 4 | 5 | dimension: id { 6 | primary_key: yes 7 | type: number 8 | sql: ${TABLE}."ID" ;; 9 | } 10 | 11 | dimension: description { 12 | type: string 13 | sql: ${TABLE}."DESCRIPTION" ;; 14 | } 15 | 16 | dimension: drink_type { 17 | type: number 18 | sql: ${TABLE}."DRINK_TYPE" ;; 19 | } 20 | 21 | dimension: name { 22 | type: string 23 | sql: ${TABLE}."NAME" ;; 24 | } 25 | 26 | dimension: validated { 27 | type: yesno 28 | sql: ${TABLE}."VALIDATED" ;; 29 | } 30 | 31 | measure: count { 32 | type: count 33 | drill_fields: [id, name] 34 | } 35 | } -------------------------------------------------------------------------------- /tipsi/tipsi_united/products.view.lkml: -------------------------------------------------------------------------------- 1 | view: products_tipsi_united { 2 | derived_table: { 3 | explore_source: products_tipsi { 4 | column: id {} 5 | column: product_id {} 6 | column: brand {} 7 | column: name {} 8 | column: variant {} 9 | derived_column: source { 10 | sql: 'tipsi' ;; 11 | } 12 | column: size {} 13 | column: category {} 14 | column: subcategory {} 15 | 16 | } 17 | } 18 | dimension: id { 19 | type: number 20 | } 21 | dimension: product_id {} 22 | dimension: brand {} 23 | dimension: name {} 24 | dimension: variant {} 25 | dimension: source { 26 | type: string 27 | } 28 | dimension: size {} 29 | dimension: category {} 30 | dimension: subcategory {} 31 | } 32 | -------------------------------------------------------------------------------- /bridge/bridge_united/products.view.lkml: -------------------------------------------------------------------------------- 1 | view: products_bridge_united { 2 | derived_table: { 3 | explore_source: products_bridge { 4 | column: id {} 5 | column: product_id {} 6 | column: brand {} 7 | column: name {} 8 | column: variant {} 9 | derived_column: source { 10 | sql: 'bridge' ;; 11 | } 12 | column: size {} 13 | column: category {} 14 | column: subcategory {} 15 | 16 | } 17 | } 18 | dimension: id { 19 | type: number 20 | } 21 | dimension: product_id {} 22 | dimension: brand {} 23 | dimension: name {} 24 | dimension: variant {} 25 | dimension: source { 26 | type: string 27 | } 28 | dimension: size {} 29 | dimension: category {} 30 | dimension: subcategory {} 31 | } 32 | -------------------------------------------------------------------------------- /drync/drync_united/products.view.lkml: -------------------------------------------------------------------------------- 1 | view: products_drync_united { 2 | derived_table: { 3 | explore_source: products_drync { 4 | column: id {} 5 | column: product_id { field: products_drync.bridge_product_id } 6 | column: brand {} 7 | column: name {} 8 | column: variant {} 9 | derived_column: source { 10 | sql: 'drync' ;; 11 | } 12 | column: size {} 13 | column: category {} 14 | column: subcategory {} 15 | 16 | } 17 | } 18 | dimension: id { 19 | type: number 20 | } 21 | dimension: product_id {} 22 | dimension: brand {} 23 | dimension: name {} 24 | dimension: variant {} 25 | dimension: source { 26 | type: string 27 | } 28 | dimension: size {} 29 | dimension: category {} 30 | dimension: subcategory {} 31 | } 32 | -------------------------------------------------------------------------------- /tipsi/tipsi_united/fulfillers.view.lkml: -------------------------------------------------------------------------------- 1 | view: fulfillers_tipsi_united { 2 | derived_table: { 3 | explore_source: retail_retailgroup { 4 | column: fulfiller_id {field:retail_retailgroup.id} 5 | column: fulfiller_name {field:retail_retailgroup.name} 6 | derived_column: organization_id { 7 | sql: 0 ;; 8 | } 9 | derived_column: organization_name { 10 | sql: null ;; 11 | } 12 | derived_column: organization_short_name { 13 | sql: null ;; 14 | } 15 | derived_column: source { 16 | sql: 'tipsi' ;; 17 | } 18 | } 19 | } 20 | dimension: fulfiller_id {} 21 | dimension: fulfiller_name {} 22 | dimension: organization_id {} 23 | dimension: organization_name {} 24 | dimension: source { 25 | type: string 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /bridge/bridge_united/fulfillers.view.lkml: -------------------------------------------------------------------------------- 1 | 2 | view: fulfillers_bridge_united { 3 | derived_table: { 4 | explore_source: retail_retailgroup_bridge { 5 | column: fulfiller_id {field:core_restaurant_bridge.id} 6 | column: fulfiller_name {field:core_restaurant_bridge.name} 7 | column: organization_id {field:retail_retailgroup_bridge.id} 8 | column: organization_name {field:retail_retailgroup_bridge.name} 9 | column: organization_short_name {field: retail_retailgroup_bridge.short_name} 10 | derived_column: source { 11 | sql: 'bridge' ;; 12 | } 13 | } 14 | } 15 | dimension: fulfiller_id {} 16 | dimension: fulfiller_name {} 17 | dimension: organization_id {} 18 | dimension: organization_name {} 19 | dimension: source { 20 | type: string 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /tipsi/views/retail_retailgroup.view.lkml: -------------------------------------------------------------------------------- 1 | view: retail_retailgroup { 2 | sql_table_name: TIPSI.PUBLIC.RETAIL_RETAILGROUP ;; 3 | drill_fields: [id] 4 | 5 | dimension: id { 6 | primary_key: yes 7 | type: number 8 | sql: ${TABLE}."ID" ;; 9 | } 10 | 11 | dimension: description { 12 | type: string 13 | sql: ${TABLE}."DESCRIPTION" ;; 14 | } 15 | 16 | dimension: internal_note { 17 | type: string 18 | sql: ${TABLE}."INTERNAL_NOTE" ;; 19 | } 20 | 21 | dimension: logo_url { 22 | type: string 23 | sql: ${TABLE}."LOGO_URL" ;; 24 | } 25 | 26 | dimension: name { 27 | type: string 28 | sql: ${TABLE}."NAME" ;; 29 | } 30 | 31 | dimension: shortcut { 32 | type: string 33 | sql: ${TABLE}."SHORTCUT" ;; 34 | } 35 | 36 | dimension: tos { 37 | type: string 38 | sql: ${TABLE}."TOS" ;; 39 | } 40 | 41 | measure: count { 42 | type: count 43 | drill_fields: [id, name] 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /united/devices.view.lkml: -------------------------------------------------------------------------------- 1 | include: "../drync/drync_united/devices.view.lkml" 2 | include: "../tipsi/tipsi_united/devices.view.lkml" 3 | include: "../bridge/bridge_united/devices.view.lkml" 4 | 5 | 6 | 7 | 8 | view: devices_united { 9 | # Or, you could make this view a derived table, like this: 10 | derived_table: { 11 | datagroup_trigger: bridge_default 12 | sql: SELECT * FROM ${devices_drync_united.SQL_TABLE_NAME} 13 | UNION 14 | SELECT * FROM ${devices_tipsi_united.SQL_TABLE_NAME} 15 | UNION 16 | SELECT * FROM ${devices_bridge_united.SQL_TABLE_NAME} 17 | ;; 18 | } 19 | 20 | dimension: source_id { 21 | type: string 22 | primary_key: yes 23 | sql: ${source} || ${device_id} ;; 24 | } 25 | dimension: device_id {} 26 | dimension: user_id {} 27 | dimension: source_user_id { 28 | sql: ${source} || ${user_id} ;; 29 | } 30 | dimension: source { 31 | type: string 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /tipsi/views/api_winescoringvintagetbl.view.lkml: -------------------------------------------------------------------------------- 1 | view: api_winescoringvintagetbl { 2 | sql_table_name: TIPSI.PUBLIC.API_WINESCORINGVINTAGETBL ;; 3 | drill_fields: [id] 4 | 5 | dimension: id { 6 | primary_key: yes 7 | type: number 8 | sql: ${TABLE}."ID" ;; 9 | } 10 | 11 | dimension: country_id { 12 | type: number 13 | sql: ${TABLE}."COUNTRY_ID" ;; 14 | } 15 | 16 | dimension: region_id { 17 | type: number 18 | sql: ${TABLE}."REGION_ID" ;; 19 | } 20 | 21 | dimension: score { 22 | type: number 23 | sql: ${TABLE}."SCORE" ;; 24 | } 25 | 26 | dimension: sub_region_id { 27 | type: number 28 | sql: ${TABLE}."SUB_REGION_ID" ;; 29 | } 30 | 31 | dimension: varietal_id { 32 | type: number 33 | sql: ${TABLE}."VARIETAL_ID" ;; 34 | } 35 | 36 | dimension: vintage { 37 | type: number 38 | sql: ${TABLE}."VINTAGE" ;; 39 | } 40 | 41 | measure: count { 42 | type: count 43 | drill_fields: [id] 44 | } 45 | } -------------------------------------------------------------------------------- /tipsi/views/api_winery.view.lkml: -------------------------------------------------------------------------------- 1 | view: api_winery { 2 | sql_table_name: TIPSI.PUBLIC.API_WINERY ;; 3 | drill_fields: [id] 4 | 5 | dimension: id { 6 | primary_key: yes 7 | type: number 8 | sql: ${TABLE}."ID" ;; 9 | } 10 | 11 | dimension_group: created { 12 | type: time 13 | timeframes: [ 14 | raw, 15 | time, 16 | date, 17 | week, 18 | month, 19 | quarter, 20 | year 21 | ] 22 | sql: ${TABLE}."CREATED" ;; 23 | } 24 | 25 | dimension: name { 26 | type: string 27 | sql: ${TABLE}."NAME" ;; 28 | } 29 | 30 | dimension_group: updated { 31 | type: time 32 | timeframes: [ 33 | raw, 34 | time, 35 | date, 36 | week, 37 | month, 38 | quarter, 39 | year 40 | ] 41 | sql: ${TABLE}."UPDATED" ;; 42 | } 43 | 44 | dimension: validated { 45 | type: yesno 46 | sql: ${TABLE}."VALIDATED" ;; 47 | } 48 | 49 | measure: count { 50 | type: count 51 | drill_fields: [id, name] 52 | } 53 | } -------------------------------------------------------------------------------- /tipsi/views/notifications_fcmdevice.view.lkml: -------------------------------------------------------------------------------- 1 | view: notifications_fcmdevice { 2 | sql_table_name: TIPSI.PUBLIC.NOTIFICATIONS_FCMDEVICE ;; 3 | 4 | dimension: device_id { 5 | primary_key: yes #https://dryncapp.looker.com/sql/4jzzr2vhxtqnzs 6 | type: string 7 | sql: ${TABLE}."DEVICE_ID" ;; 8 | } 9 | 10 | dimension: enabled { 11 | type: yesno 12 | sql: ${TABLE}."ENABLED" ;; 13 | } 14 | 15 | dimension: group_id { 16 | type: number 17 | sql: ${TABLE}."GROUP_ID" ;; 18 | } 19 | 20 | dimension: name { 21 | type: string 22 | sql: ${TABLE}."NAME" ;; 23 | } 24 | 25 | dimension: token { 26 | type: string 27 | sql: ${TABLE}."TOKEN" ;; 28 | } 29 | 30 | dimension: type { 31 | type: number 32 | sql: ${TABLE}."TYPE" ;; 33 | } 34 | 35 | dimension: user_id { 36 | type: number 37 | sql: ${TABLE}."USER_ID" ;; 38 | } 39 | 40 | dimension: id { 41 | type: number 42 | sql: ${TABLE}."ID" ;; 43 | } 44 | 45 | measure: count { 46 | type: count 47 | drill_fields: [name] 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /united/fulfillers.view.lkml: -------------------------------------------------------------------------------- 1 | include: "../drync/drync_united/fulfillers.view.lkml" 2 | include: "../tipsi/tipsi_united/fulfillers.view.lkml" 3 | include: "../bridge/bridge_united/fulfillers.view.lkml" 4 | 5 | 6 | 7 | 8 | view: fulfillers_united { 9 | # Or, you could make this view a derived table, like this: 10 | derived_table: { 11 | # datagroup_trigger: bridge_default 12 | sql: SELECT * FROM ${fulfillers_drync_united.SQL_TABLE_NAME} 13 | UNION 14 | SELECT * FROM ${fulfillers_tipsi_united.SQL_TABLE_NAME} 15 | UNION 16 | SELECT * FROM ${fulfillers_bridge_united.SQL_TABLE_NAME} 17 | ;; 18 | } 19 | 20 | dimension: pk_id { 21 | type: string 22 | primary_key: yes 23 | sql: ${source} || ${fulfiller_id} ;; 24 | } 25 | dimension: fulfiller_id {} 26 | dimension: fulfiller_name {} 27 | dimension: organization_id {} 28 | dimension: organization_name {} 29 | dimension: organization_short_name {} 30 | dimension: source { 31 | type: string 32 | } 33 | 34 | measure: count { 35 | type: count 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /tipsi/views/api_vineyard.view.lkml: -------------------------------------------------------------------------------- 1 | view: api_vineyard { 2 | sql_table_name: TIPSI.PUBLIC.API_VINEYARD ;; 3 | drill_fields: [id] 4 | 5 | dimension: id { 6 | primary_key: yes 7 | type: number 8 | sql: ${TABLE}."ID" ;; 9 | } 10 | 11 | dimension_group: created { 12 | type: time 13 | timeframes: [ 14 | raw, 15 | time, 16 | date, 17 | week, 18 | month, 19 | quarter, 20 | year 21 | ] 22 | sql: ${TABLE}."CREATED" ;; 23 | } 24 | 25 | dimension: description { 26 | type: string 27 | sql: ${TABLE}."DESCRIPTION" ;; 28 | } 29 | 30 | dimension: name { 31 | type: string 32 | sql: ${TABLE}."NAME" ;; 33 | } 34 | 35 | dimension_group: updated { 36 | type: time 37 | timeframes: [ 38 | raw, 39 | time, 40 | date, 41 | week, 42 | month, 43 | quarter, 44 | year 45 | ] 46 | sql: ${TABLE}."UPDATED" ;; 47 | } 48 | 49 | dimension: validated { 50 | type: yesno 51 | sql: ${TABLE}."VALIDATED" ;; 52 | } 53 | 54 | measure: count { 55 | type: count 56 | drill_fields: [id, name] 57 | } 58 | } -------------------------------------------------------------------------------- /tipsi/views/retail_categoryitem.view.lkml: -------------------------------------------------------------------------------- 1 | view: retail_categoryitem { 2 | sql_table_name: TIPSI.PUBLIC.RETAIL_CATEGORYITEM ;; 3 | drill_fields: [id] 4 | 5 | dimension: id { 6 | primary_key: yes 7 | type: number 8 | sql: ${TABLE}."ID" ;; 9 | } 10 | 11 | dimension: category_id { 12 | type: number 13 | sql: ${TABLE}."CATEGORY_ID" ;; 14 | } 15 | 16 | dimension_group: created { 17 | type: time 18 | timeframes: [ 19 | raw, 20 | time, 21 | date, 22 | week, 23 | month, 24 | quarter, 25 | year 26 | ] 27 | sql: ${TABLE}."CREATED" ;; 28 | } 29 | 30 | dimension: inventory_id { 31 | type: number 32 | sql: ${TABLE}."INVENTORY_ID" ;; 33 | } 34 | 35 | dimension: ordering { 36 | type: number 37 | sql: ${TABLE}."ORDERING" ;; 38 | } 39 | 40 | dimension_group: updated { 41 | type: time 42 | timeframes: [ 43 | raw, 44 | time, 45 | date, 46 | week, 47 | month, 48 | quarter, 49 | year 50 | ] 51 | sql: ${TABLE}."UPDATED" ;; 52 | } 53 | 54 | measure: count { 55 | type: count 56 | drill_fields: [id] 57 | } 58 | } -------------------------------------------------------------------------------- /tipsi/views/vendor_drinkinventory.view.lkml: -------------------------------------------------------------------------------- 1 | view: vendor_drinkinventory { 2 | sql_table_name: TIPSI.PUBLIC.VENDOR_DRINKINVENTORY ;; 3 | drill_fields: [id] 4 | 5 | dimension: id { 6 | primary_key: yes 7 | type: number 8 | sql: ${TABLE}."ID" ;; 9 | } 10 | 11 | dimension: drink_id { 12 | type: number 13 | sql: ${TABLE}."DRINK_ID" ;; 14 | } 15 | 16 | dimension: ordering { 17 | type: number 18 | sql: ${TABLE}."ORDERING" ;; 19 | } 20 | 21 | dimension: price { 22 | type: number 23 | sql: ${TABLE}."PRICE" ;; 24 | } 25 | 26 | dimension: restaurant_id { 27 | type: number 28 | sql: ${TABLE}."RESTAURANT_ID" ;; 29 | } 30 | 31 | dimension: special_price { 32 | type: number 33 | sql: ${TABLE}."SPECIAL_PRICE" ;; 34 | } 35 | 36 | dimension: special_price_on { 37 | type: yesno 38 | sql: ${TABLE}."SPECIAL_PRICE_ON" ;; 39 | } 40 | 41 | dimension: status { 42 | type: number 43 | sql: ${TABLE}."STATUS" ;; 44 | } 45 | 46 | dimension: visible { 47 | type: yesno 48 | sql: ${TABLE}."VISIBLE" ;; 49 | } 50 | 51 | measure: count { 52 | type: count 53 | drill_fields: [id] 54 | } 55 | } -------------------------------------------------------------------------------- /tipsi/views/api_varietal.view.lkml: -------------------------------------------------------------------------------- 1 | view: api_varietal { 2 | sql_table_name: TIPSI.PUBLIC.API_VARIETAL ;; 3 | drill_fields: [id] 4 | 5 | dimension: id { 6 | primary_key: yes 7 | type: number 8 | sql: ${TABLE}."ID" ;; 9 | } 10 | 11 | dimension: color { 12 | type: number 13 | sql: ${TABLE}."COLOR" ;; 14 | } 15 | 16 | dimension_group: created { 17 | type: time 18 | timeframes: [ 19 | raw, 20 | time, 21 | date, 22 | week, 23 | month, 24 | quarter, 25 | year 26 | ] 27 | sql: ${TABLE}."CREATED" ;; 28 | } 29 | 30 | dimension: description { 31 | type: string 32 | sql: ${TABLE}."DESCRIPTION" ;; 33 | } 34 | 35 | dimension: name { 36 | type: string 37 | sql: ${TABLE}."NAME" ;; 38 | } 39 | 40 | dimension_group: updated { 41 | type: time 42 | timeframes: [ 43 | raw, 44 | time, 45 | date, 46 | week, 47 | month, 48 | quarter, 49 | year 50 | ] 51 | sql: ${TABLE}."UPDATED" ;; 52 | } 53 | 54 | dimension: validated { 55 | type: yesno 56 | sql: ${TABLE}."VALIDATED" ;; 57 | } 58 | 59 | measure: count { 60 | type: count 61 | drill_fields: [id, name] 62 | } 63 | } -------------------------------------------------------------------------------- /united/products.view.lkml: -------------------------------------------------------------------------------- 1 | include: "../drync/drync_united/products.view.lkml" 2 | include: "../tipsi/tipsi_united/products.view.lkml" 3 | include: "../bridge/bridge_united/products.view.lkml" 4 | 5 | 6 | 7 | view: products_united { 8 | # Or, you could make this view a derived table, like this: 9 | derived_table: { 10 | datagroup_trigger: bridge_default 11 | sql: SELECT * FROM ${products_drync_united.SQL_TABLE_NAME} 12 | UNION 13 | SELECT * FROM ${products_tipsi_united.SQL_TABLE_NAME} 14 | UNION 15 | SELECT * FROM ${products_bridge_united.SQL_TABLE_NAME} 16 | ;; 17 | } 18 | 19 | dimension: id { 20 | type: number 21 | } 22 | 23 | dimension: pk_id { 24 | type: string 25 | primary_key: yes 26 | sql: ${source} || ${id} ;; 27 | } 28 | dimension: product_id {} 29 | 30 | dimension: source_product_id { 31 | sql: ${source} || ${product_id} ;; 32 | } 33 | 34 | dimension: brand {} 35 | dimension: name {} 36 | dimension: variant {} 37 | dimension: source { 38 | type: string 39 | } 40 | dimension: size {} 41 | dimension: category {} 42 | dimension: subcategory {} 43 | 44 | measure: count { 45 | type: count 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /drync/order_percentage.view.lkml: -------------------------------------------------------------------------------- 1 | view: order_percentage { 2 | derived_table: { 3 | sql: SELECT id as order_id, created_at, total, LAG((total/100)) OVER(order by created_at asc) as prev_val FROM marketing.public.orders WHERE total > 0 ;; 4 | } 5 | 6 | dimension: order_id { 7 | type: number 8 | sql: ${TABLE}.order_id ;; 9 | primary_key: yes 10 | hidden: yes 11 | } 12 | 13 | dimension_group: created_at { 14 | type: time 15 | timeframes: [ 16 | raw, 17 | hour_of_day, 18 | time, 19 | date, 20 | day_of_week, 21 | week, 22 | month, 23 | quarter, 24 | year 25 | ] 26 | sql: ${TABLE}.created_at ;; 27 | } 28 | 29 | dimension: total { 30 | type: number 31 | sql: ${TABLE}.total/100 ;; 32 | value_format_name: usd 33 | } 34 | 35 | dimension: prev_val { 36 | type: number 37 | sql: ${TABLE}.prev_val ;; 38 | value_format_name: usd 39 | } 40 | 41 | dimension: percent_of_previous { 42 | type: number 43 | sql: ${total}/nullif(${prev_val},0) ;; 44 | value_format_name: percent_0 45 | } 46 | 47 | dimension: percent_change { 48 | type: number 49 | sql: ${total}/nullif(${prev_val},0) - 1 ;; 50 | value_format_name: percent_0 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /drync/order_items_base_drync.view.lkml: -------------------------------------------------------------------------------- 1 | 2 | view: order_items_base_drync { 3 | derived_table: { 4 | explore_source: line_items { 5 | column: transaction_id { field: shipments.order_id } 6 | column: order_created_time { field: orders.created_time } 7 | column: SKU_id { field: products_drync.id } 8 | column: SKU_name { field: products_drync.name } 9 | column: brand_id { field: products_drync.brand_id } 10 | column: brand_name { field: products_drync.brand } 11 | column: department_id { field: products_drync.department_id } 12 | column: department_name { field: products_drync.department_name } 13 | column: user_id { field: orders.user_id } 14 | column: sale_amt { field: orders.sale_price } 15 | column: margin_amt { field: orders.margin_amt } 16 | } 17 | } 18 | dimension: transaction_id { 19 | type: number 20 | } 21 | dimension_group: created { 22 | type: time 23 | datatype: timestamp 24 | sql: ${TABLE}.order_created_time ;; 25 | } 26 | dimension: id { 27 | type: number 28 | } 29 | dimension: name {} 30 | dimension: brand {} 31 | dimension: sale_price { 32 | value_format: "$#,##0.00" 33 | type: number 34 | } 35 | measure: count { 36 | type: count 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /drync/drync_united/order_product.view.lkml: -------------------------------------------------------------------------------- 1 | view: order_product_drync_united { 2 | derived_table: { 3 | explore_source: line_items { 4 | column: id {} 5 | column: order_id { field: shipments.order_id } 6 | column: bottle_id { field: line_items.bridge_bottle_id } 7 | column: price_per_bottle {} 8 | column: quantity {} 9 | column: discount_per_bottle {} 10 | column: fulfillment_method {field: shipments.fulfillment_method} 11 | derived_column: source { 12 | sql: 'drync' ;; 13 | } 14 | derived_column: order_list_price { 15 | sql: sum(price_per_bottle*quantity) over (partition by order_id) ;; 16 | } 17 | } 18 | } 19 | dimension: id { 20 | type: number 21 | primary_key: yes 22 | } 23 | dimension: order_id { 24 | type: number 25 | } 26 | dimension: bottle_id { 27 | type: number 28 | } 29 | dimension: price_per_bottle { 30 | value_format: "$#,##0.00" 31 | type: number 32 | } 33 | dimension: quantity { 34 | type: number 35 | } 36 | dimension: order_list_price { 37 | type: number 38 | } 39 | dimension: discount_per_bottle { 40 | value_format: "$#,##0.00" 41 | type: number 42 | } 43 | dimension: source { 44 | type: string 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /tipsi/views/api_region.view.lkml: -------------------------------------------------------------------------------- 1 | view: api_region { 2 | sql_table_name: TIPSI.PUBLIC.API_REGION ;; 3 | drill_fields: [id] 4 | 5 | dimension: id { 6 | primary_key: yes 7 | type: number 8 | sql: ${TABLE}."ID" ;; 9 | } 10 | 11 | dimension_group: created { 12 | type: time 13 | timeframes: [ 14 | raw, 15 | time, 16 | date, 17 | week, 18 | month, 19 | quarter, 20 | year 21 | ] 22 | sql: ${TABLE}."CREATED" ;; 23 | } 24 | 25 | dimension: description { 26 | type: string 27 | sql: ${TABLE}."DESCRIPTION" ;; 28 | } 29 | 30 | dimension: image { 31 | type: string 32 | sql: ${TABLE}."IMAGE" ;; 33 | } 34 | 35 | dimension: name { 36 | type: string 37 | sql: ${TABLE}."NAME" ;; 38 | } 39 | 40 | dimension: old_world { 41 | type: yesno 42 | sql: ${TABLE}."OLD_WORLD" ;; 43 | } 44 | 45 | dimension_group: updated { 46 | type: time 47 | timeframes: [ 48 | raw, 49 | time, 50 | date, 51 | week, 52 | month, 53 | quarter, 54 | year 55 | ] 56 | sql: ${TABLE}."UPDATED" ;; 57 | } 58 | 59 | dimension: validated { 60 | type: yesno 61 | sql: ${TABLE}."VALIDATED" ;; 62 | } 63 | 64 | measure: count { 65 | type: count 66 | drill_fields: [id, name] 67 | } 68 | } -------------------------------------------------------------------------------- /iowa/iowa.view.lkml: -------------------------------------------------------------------------------- 1 | view: iowa { 2 | sql_table_name: production.production.iowa ;; 3 | 4 | dimension: invoice_id { 5 | primary_key: yes 6 | type: string 7 | sql: ${TABLE}.invoice_id ;; 8 | } 9 | 10 | dimension: created { 11 | type: date 12 | } 13 | 14 | dimension: store_id { type: number } 15 | dimension: store_name { type: string } 16 | dimension: address { type: string } 17 | dimension: city { type: string } 18 | dimension: zip { type: number } 19 | dimension: store_location { type: string } 20 | dimension: county_number { type: number } 21 | # cannot alter column rename in snowflake 22 | dimension: county { 23 | type: string 24 | sql: ${TABLE}.country ;; 25 | } 26 | dimension: category_id { type: number } 27 | dimension: category_name { type: string } 28 | dimension: vendor_id { type: number } 29 | dimension: vendor_name { type: string } 30 | dimension: item_id { type: number } 31 | dimension: item_description { type: string } 32 | dimension: pack { type: number } 33 | dimension: volume_ml { type: number } 34 | dimension: state_cost { type: number } 35 | dimension: state_bottle_retail { type: number } 36 | dimension: bottles_sold { type: number } 37 | dimension: sale_dollars { type: number } 38 | dimension: volume_sold_liters { type: number } 39 | dimension: volume_sold_gallons { type: number } 40 | } 41 | -------------------------------------------------------------------------------- /tipsi/tipsi_united/order_product.view.lkml: -------------------------------------------------------------------------------- 1 | view: order_product_tipsi_united { 2 | # If necessary, uncomment the line below to include explore_source. 3 | 4 | # include: "tipsi.explore.view.lkml" 5 | 6 | derived_table: { 7 | explore_source: order_products_tipsi { 8 | column: id {} 9 | column: order_id {} 10 | column: bottle_id {} 11 | column: price_per_bottle {} 12 | column: quantity {} 13 | column: discount_per_bottle {} 14 | derived_column: fulfillment_method { 15 | sql: '' ;; 16 | } 17 | derived_column: source { 18 | sql: 'tipsi' ;; 19 | } 20 | derived_column: order_list_price { 21 | sql: sum(price_per_bottle*quantity) over (partition by order_id) ;; 22 | } 23 | } 24 | } 25 | dimension: id { 26 | type: number 27 | primary_key: yes 28 | } 29 | dimension: order_id { 30 | type: number 31 | } 32 | dimension: bottle_id { 33 | type: number 34 | } 35 | dimension: price_per_bottle { 36 | type: number 37 | } 38 | dimension: quantity { 39 | type: number 40 | } 41 | dimension: discount_per_bottle { 42 | type: number 43 | } 44 | dimension: source { 45 | type: string 46 | } 47 | dimension: order_list_price { 48 | type: number 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /bridge/bridge_united/order_product.view.lkml: -------------------------------------------------------------------------------- 1 | view: order_product_bridge_united { 2 | # If necessary, uncomment the line below to include explore_source. 3 | 4 | # include: "tipsi.explore.view.lkml" 5 | 6 | derived_table: { 7 | explore_source: order_orderproduct_bridge { 8 | column: id {} 9 | column: order_id {} 10 | column: bottle_id {} 11 | column: price_per_bottle {} 12 | column: quantity {} 13 | column: discount_per_bottle {} 14 | derived_column: fulfillment_method { 15 | sql: null ;; 16 | } 17 | derived_column: source { 18 | sql: 'bridge' ;; 19 | } 20 | derived_column: order_list_price { 21 | sql: sum(price_per_bottle*quantity) over (partition by order_id) ;; 22 | } 23 | } 24 | } 25 | dimension: id { 26 | type: number 27 | primary_key: yes 28 | } 29 | dimension: order_id { 30 | type: number 31 | } 32 | dimension: bottle_id { 33 | type: number 34 | } 35 | dimension: price_per_bottle { 36 | type: number 37 | } 38 | dimension: quantity { 39 | type: number 40 | } 41 | dimension: discount_per_bottle { 42 | type: number 43 | } 44 | dimension: source { 45 | type: string 46 | } 47 | dimension: order_list_price { 48 | type: number 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /tipsi/tipsi_united/orders.view.lkml: -------------------------------------------------------------------------------- 1 | view: orders_tipsi_united { 2 | derived_table: { 3 | explore_source: orders_tipsi { 4 | column: id {} 5 | column: created_time { field: orders_tipsi.created_time } 6 | column: quantity { field: orders_tipsi.total_count } 7 | column: store_id {} 8 | column: user_id {} 9 | column: discount { field: orders_tipsi.products_discount } 10 | column: total_price {} 11 | column: status {field: orders_tipsi.order_status} 12 | column: actual_order_price {} 13 | derived_column: payment_method { 14 | sql: '' ;; 15 | } 16 | derived_column: subtotal {sql: null ;;} 17 | derived_column: deposit {sql: null ;;} 18 | derived_column: tax {sql: null ;;} 19 | derived_column: gift_recipient { 20 | sql: null ;; 21 | } 22 | derived_column: source { 23 | sql: 'tipsi' ;; 24 | } 25 | } 26 | } 27 | dimension: id { 28 | type: number 29 | } 30 | dimension_group: created { 31 | type: time 32 | sql: ${TABLE}.created_time ;; 33 | } 34 | dimension: gift_recipient { 35 | type: string 36 | } 37 | dimension: source { 38 | type: string 39 | } 40 | dimension: quantity { 41 | type: number 42 | } 43 | dimension: store_id {} 44 | dimension: user_id {} 45 | dimension: discount {} 46 | dimension: total_price {} 47 | dimension: status {} 48 | } 49 | -------------------------------------------------------------------------------- /tipsi/views/api_subregion.view.lkml: -------------------------------------------------------------------------------- 1 | view: api_subregion { 2 | sql_table_name: TIPSI.PUBLIC.API_SUBREGION ;; 3 | drill_fields: [id] 4 | 5 | dimension: id { 6 | primary_key: yes 7 | type: number 8 | sql: ${TABLE}."ID" ;; 9 | } 10 | 11 | dimension_group: created { 12 | type: time 13 | timeframes: [ 14 | raw, 15 | time, 16 | date, 17 | week, 18 | month, 19 | quarter, 20 | year 21 | ] 22 | sql: ${TABLE}."CREATED" ;; 23 | } 24 | 25 | dimension: description { 26 | type: string 27 | sql: ${TABLE}."DESCRIPTION" ;; 28 | } 29 | 30 | dimension: image { 31 | type: string 32 | sql: ${TABLE}."IMAGE" ;; 33 | } 34 | 35 | dimension: name { 36 | type: string 37 | sql: ${TABLE}."NAME" ;; 38 | } 39 | 40 | dimension: old_world { 41 | type: yesno 42 | sql: ${TABLE}."OLD_WORLD" ;; 43 | } 44 | 45 | dimension: type { 46 | type: number 47 | sql: ${TABLE}."TYPE" ;; 48 | } 49 | 50 | dimension_group: updated { 51 | type: time 52 | timeframes: [ 53 | raw, 54 | time, 55 | date, 56 | week, 57 | month, 58 | quarter, 59 | year 60 | ] 61 | sql: ${TABLE}."UPDATED" ;; 62 | } 63 | 64 | dimension: validated { 65 | type: yesno 66 | sql: ${TABLE}."VALIDATED" ;; 67 | } 68 | 69 | measure: count { 70 | type: count 71 | drill_fields: [id, name] 72 | } 73 | } -------------------------------------------------------------------------------- /tipsi/views/api_country.view.lkml: -------------------------------------------------------------------------------- 1 | view: api_country { 2 | sql_table_name: TIPSI.PUBLIC.API_COUNTRY ;; 3 | drill_fields: [id] 4 | 5 | dimension: id { 6 | primary_key: yes 7 | type: number 8 | sql: ${TABLE}."ID" ;; 9 | } 10 | 11 | dimension_group: created { 12 | type: time 13 | timeframes: [ 14 | raw, 15 | time, 16 | date, 17 | week, 18 | month, 19 | quarter, 20 | year 21 | ] 22 | sql: ${TABLE}."CREATED" ;; 23 | } 24 | 25 | dimension: description { 26 | type: string 27 | sql: ${TABLE}."DESCRIPTION" ;; 28 | } 29 | 30 | dimension: image { 31 | type: string 32 | sql: ${TABLE}."IMAGE" ;; 33 | } 34 | 35 | dimension: name { 36 | type: string 37 | sql: ${TABLE}."NAME" ;; 38 | } 39 | 40 | dimension: name_pattern { 41 | type: number 42 | sql: ${TABLE}."NAME_PATTERN" ;; 43 | } 44 | 45 | dimension: old_world { 46 | type: yesno 47 | sql: ${TABLE}."OLD_WORLD" ;; 48 | } 49 | 50 | dimension_group: updated { 51 | type: time 52 | timeframes: [ 53 | raw, 54 | time, 55 | date, 56 | week, 57 | month, 58 | quarter, 59 | year 60 | ] 61 | sql: ${TABLE}."UPDATED" ;; 62 | } 63 | 64 | dimension: validated { 65 | type: yesno 66 | sql: ${TABLE}."VALIDATED" ;; 67 | } 68 | 69 | measure: count { 70 | type: count 71 | drill_fields: [id, name] 72 | } 73 | } -------------------------------------------------------------------------------- /bridge/bridge_united/orders.view.lkml: -------------------------------------------------------------------------------- 1 | 2 | view: orders_bridge_united { 3 | derived_table: { 4 | explore_source: order_order_bridge { 5 | column: id {} 6 | column: created_time { field: order_order_bridge.created_time } 7 | column: quantity { field: order_order_bridge.total_count } 8 | column: store_id {} 9 | column: user_id {} 10 | column: discount { field: order_order_bridge.products_discount } 11 | column: total_price {} 12 | column: status {field: order_order_bridge.order_status} 13 | column: actual_order_price {} 14 | derived_column: payment_method { 15 | sql: null ;; 16 | } 17 | derived_column: subtotal {sql: null ;;} 18 | derived_column: deposit {sql: null ;;} 19 | derived_column: tax {sql: null ;;} 20 | derived_column: gift_recipient { 21 | sql: null ;; 22 | } 23 | derived_column: source { 24 | sql: 'bridge' ;; 25 | } 26 | } 27 | } 28 | dimension: id { 29 | type: number 30 | } 31 | dimension_group: created { 32 | type: time 33 | sql: ${TABLE}.created_time ;; 34 | } 35 | dimension: gift_recipient { 36 | type: string 37 | } 38 | dimension: source { 39 | type: string 40 | } 41 | dimension: quantity { 42 | type: number 43 | } 44 | dimension: store_id {} 45 | dimension: user_id {} 46 | dimension: discount {} 47 | dimension: total_price {} 48 | dimension: status {} 49 | } 50 | -------------------------------------------------------------------------------- /drync/drync_united/orders.view.lkml: -------------------------------------------------------------------------------- 1 | view: orders_drync_united { 2 | derived_table: { 3 | explore_source: orders_drync { 4 | column: id {} 5 | column: created_time { field: orders_drync.created_time } 6 | column: quantity {} 7 | column: store_id { field: orders_drync.shopping_fulfiller_id } 8 | column: user_id {} 9 | column: discount {} 10 | column: total_price {} 11 | column: status {field: orders_drync.status} 12 | column: actual_order_price {} 13 | column: payment_method {field:payments.credit_card_source} 14 | column: subtotal {field:orders_drync.sub_total} 15 | column: deposit {} 16 | column: tax {} 17 | derived_column: gift_recipient { 18 | sql: null ;; 19 | } 20 | derived_column: source { 21 | sql: 'drync' ;; 22 | } 23 | # column: sub_total {} 24 | # column: deposit {} 25 | # column: tax {} 26 | # column: shippping {} 27 | # column: shipping_adjustment {} 28 | # column: deliver_tip {} 29 | 30 | } 31 | } 32 | dimension: id { 33 | type: number 34 | } 35 | dimension_group: created { 36 | type: time 37 | sql: ${TABLE}.created_time ;; 38 | } 39 | dimension: gift_recipient { 40 | type: string 41 | } 42 | dimension: source { 43 | type: string 44 | } 45 | #dimension: quantity { 46 | # type: number 47 | # } 48 | dimension: store_id {} 49 | dimension: user_id {} 50 | dimension: status {} 51 | # dimension: discount {} 52 | # dimension: total_price {} 53 | } 54 | -------------------------------------------------------------------------------- /bridge/retail_retailstoregroupthrough.view.lkml: -------------------------------------------------------------------------------- 1 | view: retail_retailstoregroupthrough_bridge { 2 | sql_table_name: "BRIDGE"."RETAIL_RETAILSTOREGROUPTHROUGH" 3 | ;; 4 | drill_fields: [id] 5 | 6 | dimension: id { 7 | primary_key: yes 8 | type: number 9 | sql: ${TABLE}."ID" ;; 10 | } 11 | 12 | dimension_group: _sdc_batched { 13 | type: time 14 | timeframes: [ 15 | raw, 16 | time, 17 | date, 18 | week, 19 | month, 20 | quarter, 21 | year 22 | ] 23 | sql: ${TABLE}."_SDC_BATCHED_AT" ;; 24 | } 25 | 26 | dimension_group: _sdc_extracted { 27 | type: time 28 | timeframes: [ 29 | raw, 30 | time, 31 | date, 32 | week, 33 | month, 34 | quarter, 35 | year 36 | ] 37 | sql: ${TABLE}."_SDC_EXTRACTED_AT" ;; 38 | } 39 | 40 | dimension_group: _sdc_received { 41 | type: time 42 | timeframes: [ 43 | raw, 44 | time, 45 | date, 46 | week, 47 | month, 48 | quarter, 49 | year 50 | ] 51 | sql: ${TABLE}."_SDC_RECEIVED_AT" ;; 52 | } 53 | 54 | dimension: _sdc_sequence { 55 | type: number 56 | sql: ${TABLE}."_SDC_SEQUENCE" ;; 57 | } 58 | 59 | dimension: _sdc_table_version { 60 | type: number 61 | sql: ${TABLE}."_SDC_TABLE_VERSION" ;; 62 | } 63 | 64 | dimension: group_id { 65 | type: number 66 | sql: ${TABLE}."GROUP_ID" ;; 67 | } 68 | 69 | dimension: store_id { 70 | type: number 71 | sql: ${TABLE}."STORE_ID" ;; 72 | } 73 | 74 | measure: count { 75 | type: count 76 | drill_fields: [id] 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /tipsi/views/retail_store.view.lkml: -------------------------------------------------------------------------------- 1 | view: retail_store { 2 | sql_table_name: TIPSI.PUBLIC.RETAIL_STORE ;; 3 | 4 | dimension: delivery_zones { 5 | type: string 6 | sql: ${TABLE}."DELIVERY_ZONES" ;; 7 | } 8 | 9 | dimension: drink_revision { 10 | type: number 11 | sql: ${TABLE}."DRINK_REVISION" ;; 12 | } 13 | 14 | dimension: extid_auto_create_tasks { 15 | type: yesno 16 | sql: ${TABLE}."EXTID_AUTO_CREATE_TASKS" ;; 17 | } 18 | 19 | dimension: logo_url { 20 | type: string 21 | sql: ${TABLE}."LOGO_URL" ;; 22 | } 23 | 24 | dimension: orders_enabled { 25 | type: yesno 26 | sql: ${TABLE}."ORDERS_ENABLED" ;; 27 | } 28 | 29 | dimension: pos_create_tasks { 30 | type: yesno 31 | sql: ${TABLE}."POS_CREATE_TASKS" ;; 32 | } 33 | 34 | dimension: restaurant_id { 35 | type: number 36 | sql: ${TABLE}."RESTAURANT_ID" ;; 37 | } 38 | 39 | dimension: trim_checkdigit { 40 | type: yesno 41 | sql: ${TABLE}."TRIM_CHECKDIGIT" ;; 42 | } 43 | 44 | dimension: trim_leadzeroes { 45 | type: yesno 46 | sql: ${TABLE}."TRIM_LEADZEROES" ;; 47 | } 48 | 49 | dimension: upload_labels { 50 | type: yesno 51 | sql: ${TABLE}."UPLOAD_LABELS" ;; 52 | } 53 | 54 | dimension: virtual_group_id { 55 | type: number 56 | sql: ${TABLE}."VIRTUAL_GROUP_ID" ;; 57 | } 58 | 59 | dimension: wine_revision { 60 | type: number 61 | sql: ${TABLE}."WINE_REVISION" ;; 62 | } 63 | 64 | dimension: working_hours { 65 | type: string 66 | sql: ${TABLE}."WORKING_HOURS" ;; 67 | } 68 | 69 | measure: count { 70 | type: count 71 | drill_fields: [] 72 | } 73 | } -------------------------------------------------------------------------------- /bridge/vendor_drinktag.view.lkml: -------------------------------------------------------------------------------- 1 | view: vendor_drinktag_bridge { 2 | sql_table_name: "BRIDGE"."VENDOR_DRINKTAG" 3 | ;; 4 | drill_fields: [id] 5 | 6 | dimension: id { 7 | primary_key: yes 8 | type: number 9 | sql: ${TABLE}."ID" ;; 10 | } 11 | 12 | dimension_group: _sdc_batched { 13 | type: time 14 | timeframes: [ 15 | raw, 16 | time, 17 | date, 18 | week, 19 | month, 20 | quarter, 21 | year 22 | ] 23 | sql: ${TABLE}."_SDC_BATCHED_AT" ;; 24 | } 25 | 26 | dimension_group: _sdc_extracted { 27 | type: time 28 | timeframes: [ 29 | raw, 30 | time, 31 | date, 32 | week, 33 | month, 34 | quarter, 35 | year 36 | ] 37 | sql: ${TABLE}."_SDC_EXTRACTED_AT" ;; 38 | } 39 | 40 | dimension_group: _sdc_received { 41 | type: time 42 | timeframes: [ 43 | raw, 44 | time, 45 | date, 46 | week, 47 | month, 48 | quarter, 49 | year 50 | ] 51 | sql: ${TABLE}."_SDC_RECEIVED_AT" ;; 52 | } 53 | 54 | dimension: _sdc_sequence { 55 | type: number 56 | sql: ${TABLE}."_SDC_SEQUENCE" ;; 57 | } 58 | 59 | dimension: _sdc_table_version { 60 | type: number 61 | sql: ${TABLE}."_SDC_TABLE_VERSION" ;; 62 | } 63 | 64 | dimension: drink_type { 65 | type: number 66 | sql: ${TABLE}."DRINK_TYPE" ;; 67 | } 68 | 69 | dimension: name { 70 | type: string 71 | sql: ${TABLE}."NAME" ;; 72 | } 73 | 74 | dimension: validated { 75 | type: yesno 76 | sql: ${TABLE}."VALIDATED" ;; 77 | } 78 | 79 | measure: count { 80 | type: count 81 | drill_fields: [id, name] 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /bridge/vendor_drinkproducer.view.lkml: -------------------------------------------------------------------------------- 1 | view: vendor_drinkproducer_bridge { 2 | sql_table_name: "BRIDGE"."VENDOR_DRINKPRODUCER" 3 | ;; 4 | drill_fields: [id] 5 | 6 | dimension: id { 7 | primary_key: yes 8 | type: number 9 | sql: ${TABLE}."ID" ;; 10 | } 11 | 12 | dimension_group: _sdc_batched { 13 | type: time 14 | timeframes: [ 15 | raw, 16 | time, 17 | date, 18 | week, 19 | month, 20 | quarter, 21 | year 22 | ] 23 | sql: ${TABLE}."_SDC_BATCHED_AT" ;; 24 | } 25 | 26 | dimension_group: _sdc_extracted { 27 | type: time 28 | timeframes: [ 29 | raw, 30 | time, 31 | date, 32 | week, 33 | month, 34 | quarter, 35 | year 36 | ] 37 | sql: ${TABLE}."_SDC_EXTRACTED_AT" ;; 38 | } 39 | 40 | dimension_group: _sdc_received { 41 | type: time 42 | timeframes: [ 43 | raw, 44 | time, 45 | date, 46 | week, 47 | month, 48 | quarter, 49 | year 50 | ] 51 | sql: ${TABLE}."_SDC_RECEIVED_AT" ;; 52 | } 53 | 54 | dimension: _sdc_sequence { 55 | type: number 56 | sql: ${TABLE}."_SDC_SEQUENCE" ;; 57 | } 58 | 59 | dimension: _sdc_table_version { 60 | type: number 61 | sql: ${TABLE}."_SDC_TABLE_VERSION" ;; 62 | } 63 | 64 | dimension: description { 65 | type: string 66 | sql: ${TABLE}."DESCRIPTION" ;; 67 | } 68 | 69 | dimension: drink_type { 70 | type: number 71 | sql: ${TABLE}."DRINK_TYPE" ;; 72 | } 73 | 74 | dimension: name { 75 | type: string 76 | sql: ${TABLE}."NAME" ;; 77 | } 78 | 79 | dimension: validated { 80 | type: yesno 81 | sql: ${TABLE}."VALIDATED" ;; 82 | } 83 | 84 | measure: count { 85 | type: count 86 | drill_fields: [id, name] 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /bridge/notifications_fcmdevice.view.lkml: -------------------------------------------------------------------------------- 1 | view: notifications_fcmdevice_bridge { 2 | sql_table_name: "BRIDGE"."NOTIFICATIONS_FCMDEVICE" 3 | ;; 4 | 5 | dimension_group: _sdc_batched { 6 | type: time 7 | timeframes: [ 8 | raw, 9 | time, 10 | date, 11 | week, 12 | month, 13 | quarter, 14 | year 15 | ] 16 | sql: ${TABLE}."_SDC_BATCHED_AT" ;; 17 | } 18 | 19 | dimension_group: _sdc_extracted { 20 | type: time 21 | timeframes: [ 22 | raw, 23 | time, 24 | date, 25 | week, 26 | month, 27 | quarter, 28 | year 29 | ] 30 | sql: ${TABLE}."_SDC_EXTRACTED_AT" ;; 31 | } 32 | 33 | dimension_group: _sdc_received { 34 | type: time 35 | timeframes: [ 36 | raw, 37 | time, 38 | date, 39 | week, 40 | month, 41 | quarter, 42 | year 43 | ] 44 | sql: ${TABLE}."_SDC_RECEIVED_AT" ;; 45 | } 46 | 47 | dimension: _sdc_sequence { 48 | type: number 49 | sql: ${TABLE}."_SDC_SEQUENCE" ;; 50 | } 51 | 52 | dimension: _sdc_table_version { 53 | type: number 54 | sql: ${TABLE}."_SDC_TABLE_VERSION" ;; 55 | } 56 | 57 | dimension: device_id { 58 | primary_key: yes 59 | type: string 60 | sql: ${TABLE}."DEVICE_ID" ;; 61 | } 62 | 63 | dimension: enabled { 64 | type: yesno 65 | sql: ${TABLE}."ENABLED" ;; 66 | } 67 | 68 | dimension: group_id { 69 | type: number 70 | sql: ${TABLE}."GROUP_ID" ;; 71 | } 72 | 73 | dimension: token { 74 | type: string 75 | sql: ${TABLE}."TOKEN" ;; 76 | } 77 | 78 | dimension: type { 79 | type: number 80 | sql: ${TABLE}."TYPE" ;; 81 | } 82 | 83 | dimension: user_id { 84 | type: number 85 | sql: ${TABLE}."USER_ID" ;; 86 | } 87 | 88 | measure: count { 89 | type: count 90 | drill_fields: [] 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /tipsi/views/vendor_drink.view.lkml: -------------------------------------------------------------------------------- 1 | view: vendor_drink { 2 | sql_table_name: TIPSI.PUBLIC.VENDOR_DRINK ;; 3 | drill_fields: [id] 4 | 5 | dimension: id { 6 | primary_key: yes 7 | type: number 8 | sql: ${TABLE}."ID" ;; 9 | } 10 | 11 | dimension: country_id { 12 | type: number 13 | sql: ${TABLE}."COUNTRY_ID" ;; 14 | } 15 | 16 | dimension_group: created { 17 | type: time 18 | timeframes: [ 19 | raw, 20 | time, 21 | date, 22 | week, 23 | month, 24 | quarter, 25 | year 26 | ] 27 | sql: ${TABLE}."CREATED" ;; 28 | } 29 | 30 | dimension: description { 31 | type: string 32 | sql: ${TABLE}."DESCRIPTION" ;; 33 | } 34 | 35 | dimension: drink_type { 36 | type: number 37 | sql: ${TABLE}."DRINK_TYPE" ;; 38 | } 39 | 40 | dimension: label_url { 41 | type: string 42 | sql: ${TABLE}."LABEL_URL" ;; 43 | } 44 | 45 | dimension: name { 46 | type: string 47 | sql: ${TABLE}."NAME" ;; 48 | } 49 | 50 | dimension: producer_id { 51 | type: number 52 | sql: ${TABLE}."PRODUCER_ID" ;; 53 | } 54 | 55 | dimension: tag_id { 56 | type: number 57 | sql: ${TABLE}."TAG_ID" ;; 58 | } 59 | 60 | dimension: thumb_list_url { 61 | type: string 62 | sql: ${TABLE}."THUMB_LIST_URL" ;; 63 | } 64 | 65 | dimension: thumb_product_url { 66 | type: string 67 | sql: ${TABLE}."THUMB_PRODUCT_URL" ;; 68 | } 69 | 70 | dimension_group: updated { 71 | type: time 72 | timeframes: [ 73 | raw, 74 | time, 75 | date, 76 | week, 77 | month, 78 | quarter, 79 | year 80 | ] 81 | sql: ${TABLE}."UPDATED" ;; 82 | } 83 | 84 | dimension: validated { 85 | type: yesno 86 | sql: ${TABLE}."VALIDATED" ;; 87 | } 88 | 89 | measure: count { 90 | type: count 91 | drill_fields: [id, name] 92 | } 93 | } -------------------------------------------------------------------------------- /united/users.view.lkml: -------------------------------------------------------------------------------- 1 | include: "../drync/drync_united/users.view.lkml" 2 | include: "../tipsi/tipsi_united/users.view.lkml" 3 | include: "../bridge/bridge_united/users.view.lkml" 4 | 5 | 6 | 7 | view: users { 8 | extends: [users_fields] 9 | derived_table: { 10 | datagroup_trigger: bridge_default 11 | sql: SELECT * FROM ${users_drync_united.SQL_TABLE_NAME} 12 | UNION 13 | SELECT * FROM ${users_tipsi_united.SQL_TABLE_NAME} 14 | UNION 15 | SELECT * FROM ${users_bridge_united.SQL_TABLE_NAME} 16 | ;; 17 | } 18 | } 19 | 20 | view: users_fields { 21 | extension: required 22 | dimension: id { 23 | type: number 24 | } 25 | dimension: source_id { 26 | type: string 27 | primary_key: yes #https://dryncapp.looker.com/explore/bridge/users?qid=jGuxnamUWNKWSfJbr767Hs 28 | hidden: no 29 | sql: ${source} || ${id} ;; 30 | } 31 | dimension: email {} 32 | dimension: first_name {} 33 | dimension: last_name {} 34 | dimension: birth_year { 35 | type: number 36 | } 37 | dimension: source { 38 | type: string 39 | } 40 | dimension: gender {} 41 | dimension: age {} 42 | dimension: state {} 43 | dimension: us_states { 44 | type: string 45 | map_layer_name: us_states 46 | sql: CASE 47 | WHEN ${country} = 'US' THEN ${state} 48 | ELSE NULL END ;; 49 | } 50 | dimension: zipcode {} 51 | dimension: country { 52 | type: string 53 | map_layer_name: countries 54 | } 55 | dimension: age_tiers { 56 | type: tier 57 | sql: ${age} ;; 58 | tiers: [18, 30, 45, 70 ] 59 | style: integer 60 | } 61 | 62 | measure: count { 63 | type: count 64 | drill_fields: [detail*] 65 | } 66 | 67 | measure: count_percent { 68 | type: percent_of_total 69 | sql: ${count} ;; 70 | } 71 | 72 | set: detail { 73 | fields: [source, id, email, birth_year, first_name, last_name, age] 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /bridge/api_winery.view.lkml: -------------------------------------------------------------------------------- 1 | view: api_winery_bridge { 2 | sql_table_name: "BRIDGE"."API_WINERY" 3 | ;; 4 | drill_fields: [id] 5 | 6 | dimension: id { 7 | primary_key: yes 8 | type: number 9 | sql: ${TABLE}."ID" ;; 10 | } 11 | 12 | dimension_group: _sdc_batched { 13 | type: time 14 | timeframes: [ 15 | raw, 16 | time, 17 | date, 18 | week, 19 | month, 20 | quarter, 21 | year 22 | ] 23 | sql: ${TABLE}."_SDC_BATCHED_AT" ;; 24 | } 25 | 26 | dimension_group: _sdc_extracted { 27 | type: time 28 | timeframes: [ 29 | raw, 30 | time, 31 | date, 32 | week, 33 | month, 34 | quarter, 35 | year 36 | ] 37 | sql: ${TABLE}."_SDC_EXTRACTED_AT" ;; 38 | } 39 | 40 | dimension_group: _sdc_received { 41 | type: time 42 | timeframes: [ 43 | raw, 44 | time, 45 | date, 46 | week, 47 | month, 48 | quarter, 49 | year 50 | ] 51 | sql: ${TABLE}."_SDC_RECEIVED_AT" ;; 52 | } 53 | 54 | dimension: _sdc_sequence { 55 | type: number 56 | sql: ${TABLE}."_SDC_SEQUENCE" ;; 57 | } 58 | 59 | dimension: _sdc_table_version { 60 | type: number 61 | sql: ${TABLE}."_SDC_TABLE_VERSION" ;; 62 | } 63 | 64 | dimension_group: created { 65 | type: time 66 | timeframes: [ 67 | raw, 68 | time, 69 | date, 70 | week, 71 | month, 72 | quarter, 73 | year 74 | ] 75 | sql: ${TABLE}."CREATED" ;; 76 | } 77 | 78 | dimension: name { 79 | type: string 80 | sql: ${TABLE}."NAME" ;; 81 | } 82 | 83 | dimension_group: updated { 84 | type: time 85 | timeframes: [ 86 | raw, 87 | time, 88 | date, 89 | week, 90 | month, 91 | quarter, 92 | year 93 | ] 94 | sql: ${TABLE}."UPDATED" ;; 95 | } 96 | 97 | dimension: validated { 98 | type: yesno 99 | sql: ${TABLE}."VALIDATED" ;; 100 | } 101 | 102 | measure: count { 103 | type: count 104 | drill_fields: [id, name] 105 | } 106 | } 107 | -------------------------------------------------------------------------------- /tipsi/views/retail_category.view.lkml: -------------------------------------------------------------------------------- 1 | view: retail_category { 2 | sql_table_name: TIPSI.PUBLIC.RETAIL_CATEGORY ;; 3 | drill_fields: [id] 4 | 5 | dimension: id { 6 | primary_key: yes 7 | type: number 8 | sql: ${TABLE}."ID" ;; 9 | } 10 | 11 | dimension: category_path { 12 | type: string 13 | sql: ${TABLE}."CATEGORY_PATH" ;; 14 | } 15 | 16 | dimension_group: created { 17 | type: time 18 | timeframes: [ 19 | raw, 20 | time, 21 | date, 22 | week, 23 | month, 24 | quarter, 25 | year 26 | ] 27 | sql: ${TABLE}."CREATED" ;; 28 | } 29 | 30 | dimension: description { 31 | type: string 32 | sql: ${TABLE}."DESCRIPTION" ;; 33 | } 34 | 35 | dimension: drink_type { 36 | type: number 37 | sql: ${TABLE}."DRINK_TYPE" ;; 38 | } 39 | 40 | dimension: filterset_id { 41 | type: number 42 | sql: ${TABLE}."FILTERSET_ID" ;; 43 | } 44 | 45 | dimension: image { 46 | type: string 47 | sql: ${TABLE}."IMAGE" ;; 48 | } 49 | 50 | dimension: ordering { 51 | type: number 52 | sql: ${TABLE}."ORDERING" ;; 53 | } 54 | 55 | dimension: parent_id { 56 | type: number 57 | sql: ${TABLE}."PARENT_ID" ;; 58 | } 59 | 60 | dimension: pos_automatic { 61 | type: yesno 62 | sql: ${TABLE}."POS_AUTOMATIC" ;; 63 | } 64 | 65 | dimension: product_type { 66 | type: number 67 | sql: ${TABLE}."PRODUCT_TYPE" ;; 68 | } 69 | 70 | dimension: shortcut { 71 | type: string 72 | sql: ${TABLE}."SHORTCUT" ;; 73 | } 74 | 75 | dimension: store_id { 76 | type: number 77 | sql: ${TABLE}."STORE_ID" ;; 78 | } 79 | 80 | dimension: title { 81 | type: string 82 | sql: ${TABLE}."TITLE" ;; 83 | } 84 | 85 | dimension_group: updated { 86 | type: time 87 | timeframes: [ 88 | raw, 89 | time, 90 | date, 91 | week, 92 | month, 93 | quarter, 94 | year 95 | ] 96 | sql: ${TABLE}."UPDATED" ;; 97 | } 98 | 99 | measure: count { 100 | type: count 101 | drill_fields: [id] 102 | } 103 | } -------------------------------------------------------------------------------- /bridge/vendor_drinkinventory.view.lkml: -------------------------------------------------------------------------------- 1 | view: vendor_drinkinventory_bridge { 2 | sql_table_name: "BRIDGE"."VENDOR_DRINKINVENTORY" 3 | ;; 4 | drill_fields: [id] 5 | 6 | dimension: id { 7 | primary_key: yes 8 | type: number 9 | sql: ${TABLE}."ID" ;; 10 | } 11 | 12 | dimension_group: _sdc_batched { 13 | type: time 14 | timeframes: [ 15 | raw, 16 | time, 17 | date, 18 | week, 19 | month, 20 | quarter, 21 | year 22 | ] 23 | sql: ${TABLE}."_SDC_BATCHED_AT" ;; 24 | } 25 | 26 | dimension_group: _sdc_extracted { 27 | type: time 28 | timeframes: [ 29 | raw, 30 | time, 31 | date, 32 | week, 33 | month, 34 | quarter, 35 | year 36 | ] 37 | sql: ${TABLE}."_SDC_EXTRACTED_AT" ;; 38 | } 39 | 40 | dimension_group: _sdc_received { 41 | type: time 42 | timeframes: [ 43 | raw, 44 | time, 45 | date, 46 | week, 47 | month, 48 | quarter, 49 | year 50 | ] 51 | sql: ${TABLE}."_SDC_RECEIVED_AT" ;; 52 | } 53 | 54 | dimension: _sdc_sequence { 55 | type: number 56 | sql: ${TABLE}."_SDC_SEQUENCE" ;; 57 | } 58 | 59 | dimension: _sdc_table_version { 60 | type: number 61 | sql: ${TABLE}."_SDC_TABLE_VERSION" ;; 62 | } 63 | 64 | dimension: drink_id { 65 | type: number 66 | sql: ${TABLE}."DRINK_ID" ;; 67 | } 68 | 69 | dimension: ordering { 70 | type: number 71 | sql: ${TABLE}."ORDERING" ;; 72 | } 73 | 74 | dimension: price { 75 | type: number 76 | sql: ${TABLE}."PRICE" ;; 77 | } 78 | 79 | dimension: restaurant_id { 80 | type: number 81 | sql: ${TABLE}."RESTAURANT_ID" ;; 82 | } 83 | 84 | dimension: special_price { 85 | type: number 86 | sql: ${TABLE}."SPECIAL_PRICE" ;; 87 | } 88 | 89 | dimension: special_price_on { 90 | type: yesno 91 | sql: ${TABLE}."SPECIAL_PRICE_ON" ;; 92 | } 93 | 94 | dimension: status { 95 | type: number 96 | sql: ${TABLE}."STATUS" ;; 97 | } 98 | 99 | dimension: visible { 100 | type: yesno 101 | sql: ${TABLE}."VISIBLE" ;; 102 | } 103 | 104 | measure: count { 105 | type: count 106 | drill_fields: [id] 107 | } 108 | } 109 | -------------------------------------------------------------------------------- /bridge/api_varietal.view.lkml: -------------------------------------------------------------------------------- 1 | view: api_varietal_bridge { 2 | sql_table_name: "BRIDGE"."API_VARIETAL" 3 | ;; 4 | drill_fields: [id] 5 | 6 | dimension: id { 7 | primary_key: yes 8 | type: number 9 | sql: ${TABLE}."ID" ;; 10 | } 11 | 12 | dimension_group: _sdc_batched { 13 | type: time 14 | timeframes: [ 15 | raw, 16 | time, 17 | date, 18 | week, 19 | month, 20 | quarter, 21 | year 22 | ] 23 | sql: ${TABLE}."_SDC_BATCHED_AT" ;; 24 | } 25 | 26 | dimension_group: _sdc_extracted { 27 | type: time 28 | timeframes: [ 29 | raw, 30 | time, 31 | date, 32 | week, 33 | month, 34 | quarter, 35 | year 36 | ] 37 | sql: ${TABLE}."_SDC_EXTRACTED_AT" ;; 38 | } 39 | 40 | dimension_group: _sdc_received { 41 | type: time 42 | timeframes: [ 43 | raw, 44 | time, 45 | date, 46 | week, 47 | month, 48 | quarter, 49 | year 50 | ] 51 | sql: ${TABLE}."_SDC_RECEIVED_AT" ;; 52 | } 53 | 54 | dimension: _sdc_sequence { 55 | type: number 56 | sql: ${TABLE}."_SDC_SEQUENCE" ;; 57 | } 58 | 59 | dimension: _sdc_table_version { 60 | type: number 61 | sql: ${TABLE}."_SDC_TABLE_VERSION" ;; 62 | } 63 | 64 | dimension: color { 65 | type: number 66 | sql: ${TABLE}."COLOR" ;; 67 | } 68 | 69 | dimension_group: created { 70 | type: time 71 | timeframes: [ 72 | raw, 73 | time, 74 | date, 75 | week, 76 | month, 77 | quarter, 78 | year 79 | ] 80 | sql: ${TABLE}."CREATED" ;; 81 | } 82 | 83 | dimension: description { 84 | type: string 85 | sql: ${TABLE}."DESCRIPTION" ;; 86 | } 87 | 88 | dimension: name { 89 | type: string 90 | sql: ${TABLE}."NAME" ;; 91 | } 92 | 93 | dimension_group: updated { 94 | type: time 95 | timeframes: [ 96 | raw, 97 | time, 98 | date, 99 | week, 100 | month, 101 | quarter, 102 | year 103 | ] 104 | sql: ${TABLE}."UPDATED" ;; 105 | } 106 | 107 | dimension: validated { 108 | type: yesno 109 | sql: ${TABLE}."VALIDATED" ;; 110 | } 111 | 112 | measure: count { 113 | type: count 114 | drill_fields: [id, name] 115 | } 116 | } 117 | -------------------------------------------------------------------------------- /drync/app_registrations.view.lkml: -------------------------------------------------------------------------------- 1 | view: app_registrations { 2 | sql_table_name: PRODUCTION.APP_REGISTRATIONS ;; 3 | drill_fields: [id] 4 | 5 | dimension: id { 6 | primary_key: yes 7 | type: number 8 | sql: ${TABLE}."ID" ;; 9 | } 10 | 11 | dimension_group: _sdc_batched { 12 | type: time 13 | timeframes: [ 14 | raw, 15 | time, 16 | date, 17 | week, 18 | month, 19 | quarter, 20 | year 21 | ] 22 | sql: ${TABLE}."_SDC_BATCHED_AT" ;; 23 | } 24 | 25 | dimension_group: _sdc_extracted { 26 | type: time 27 | timeframes: [ 28 | raw, 29 | time, 30 | date, 31 | week, 32 | month, 33 | quarter, 34 | year 35 | ] 36 | sql: ${TABLE}."_SDC_EXTRACTED_AT" ;; 37 | } 38 | 39 | dimension_group: _sdc_received { 40 | type: time 41 | timeframes: [ 42 | raw, 43 | time, 44 | date, 45 | week, 46 | month, 47 | quarter, 48 | year 49 | ] 50 | sql: ${TABLE}."_SDC_RECEIVED_AT" ;; 51 | } 52 | 53 | dimension: _sdc_sequence { 54 | type: number 55 | sql: ${TABLE}."_SDC_SEQUENCE" ;; 56 | } 57 | 58 | dimension: _sdc_table_version { 59 | type: number 60 | sql: ${TABLE}."_SDC_TABLE_VERSION" ;; 61 | } 62 | 63 | dimension: app_id { 64 | type: number 65 | # hidden: yes 66 | sql: ${TABLE}."APP_ID" ;; 67 | } 68 | 69 | dimension: application { 70 | type: string 71 | sql: ${TABLE}."APPLICATION" ;; 72 | } 73 | 74 | dimension_group: created { 75 | type: time 76 | timeframes: [ 77 | raw, 78 | time, 79 | date, 80 | week, 81 | month, 82 | quarter, 83 | year 84 | ] 85 | sql: ${TABLE}."CREATED_AT" ;; 86 | } 87 | 88 | dimension: device_id { 89 | type: number 90 | sql: ${TABLE}."DEVICE_ID" ;; 91 | } 92 | 93 | dimension_group: updated { 94 | type: time 95 | timeframes: [ 96 | raw, 97 | time, 98 | date, 99 | week, 100 | month, 101 | quarter, 102 | year 103 | ] 104 | sql: ${TABLE}."UPDATED_AT" ;; 105 | } 106 | 107 | dimension: user_id { 108 | type: number 109 | sql: ${TABLE}."USER_ID" ;; 110 | } 111 | 112 | measure: count { 113 | type: count 114 | drill_fields: [detail*] 115 | } 116 | 117 | # ----- Sets of fields for drilling ------ 118 | set: detail { 119 | fields: [ 120 | id, 121 | apps.mailchimp_list_name, 122 | apps.name, 123 | apps.short_name, 124 | apps.id, 125 | app_sessions.count 126 | ] 127 | } 128 | } 129 | -------------------------------------------------------------------------------- /drync/apps.view.lkml: -------------------------------------------------------------------------------- 1 | view: apps { 2 | sql_table_name: PRODUCTION.APPS ;; 3 | drill_fields: [id] 4 | 5 | dimension: id { 6 | primary_key: yes 7 | type: number 8 | sql: ${TABLE}."ID" ;; 9 | } 10 | 11 | dimension_group: _sdc_batched { 12 | type: time 13 | timeframes: [ 14 | raw, 15 | time, 16 | date, 17 | week, 18 | month, 19 | quarter, 20 | year 21 | ] 22 | sql: ${TABLE}."_SDC_BATCHED_AT" ;; 23 | } 24 | 25 | dimension_group: _sdc_extracted { 26 | type: time 27 | timeframes: [ 28 | raw, 29 | time, 30 | date, 31 | week, 32 | month, 33 | quarter, 34 | year 35 | ] 36 | sql: ${TABLE}."_SDC_EXTRACTED_AT" ;; 37 | } 38 | 39 | dimension_group: _sdc_received { 40 | type: time 41 | timeframes: [ 42 | raw, 43 | time, 44 | date, 45 | week, 46 | month, 47 | quarter, 48 | year 49 | ] 50 | sql: ${TABLE}."_SDC_RECEIVED_AT" ;; 51 | } 52 | 53 | dimension: _sdc_sequence { 54 | type: number 55 | sql: ${TABLE}."_SDC_SEQUENCE" ;; 56 | } 57 | 58 | dimension: _sdc_table_version { 59 | type: number 60 | sql: ${TABLE}."_SDC_TABLE_VERSION" ;; 61 | } 62 | 63 | dimension: apple_uid { 64 | type: number 65 | value_format_name: id 66 | sql: ${TABLE}."APPLE_UID" ;; 67 | } 68 | 69 | dimension: branch_app_key { 70 | type: string 71 | sql: ${TABLE}."BRANCH_APP_KEY" ;; 72 | } 73 | 74 | dimension: localytics_android_app_key { 75 | type: string 76 | sql: ${TABLE}."LOCALYTICS_ANDROID_APP_KEY" ;; 77 | } 78 | 79 | dimension: localytics_app_key { 80 | type: string 81 | sql: ${TABLE}."LOCALYTICS_APP_KEY" ;; 82 | } 83 | 84 | dimension: mailchimp_list_name { 85 | type: string 86 | sql: ${TABLE}."MAILCHIMP_LIST_NAME" ;; 87 | } 88 | 89 | dimension: mailchimp_list_uid { 90 | type: string 91 | sql: ${TABLE}."MAILCHIMP_LIST_UID" ;; 92 | } 93 | 94 | dimension: name { 95 | type: string 96 | sql: ${TABLE}."NAME" ;; 97 | } 98 | 99 | dimension: organization_id { 100 | type: number 101 | sql: ${TABLE}."ORGANIZATION_ID" ;; 102 | } 103 | 104 | dimension: short_name { 105 | type: string 106 | sql: ${TABLE}."SHORT_NAME" ;; 107 | } 108 | 109 | measure: count { 110 | type: count 111 | drill_fields: [detail*] 112 | } 113 | 114 | # ----- Sets of fields for drilling ------ 115 | set: detail { 116 | fields: [ 117 | id, 118 | mailchimp_list_name, 119 | name, 120 | short_name, 121 | app_registrations.count, 122 | app_sessions.count 123 | ] 124 | } 125 | } 126 | -------------------------------------------------------------------------------- /bridge/retail_retailgroup.view.lkml: -------------------------------------------------------------------------------- 1 | view: retail_retailgroup_bridge { 2 | sql_table_name: "BRIDGE"."RETAIL_RETAILGROUP" 3 | ;; 4 | drill_fields: [id] 5 | 6 | dimension: id { 7 | primary_key: yes 8 | type: number 9 | sql: ${TABLE}."ID" ;; 10 | } 11 | 12 | dimension_group: _sdc_batched { 13 | type: time 14 | timeframes: [ 15 | raw, 16 | time, 17 | date, 18 | week, 19 | month, 20 | quarter, 21 | year 22 | ] 23 | sql: ${TABLE}."_SDC_BATCHED_AT" ;; 24 | } 25 | 26 | dimension_group: _sdc_extracted { 27 | type: time 28 | timeframes: [ 29 | raw, 30 | time, 31 | date, 32 | week, 33 | month, 34 | quarter, 35 | year 36 | ] 37 | sql: ${TABLE}."_SDC_EXTRACTED_AT" ;; 38 | } 39 | 40 | dimension_group: _sdc_received { 41 | type: time 42 | timeframes: [ 43 | raw, 44 | time, 45 | date, 46 | week, 47 | month, 48 | quarter, 49 | year 50 | ] 51 | sql: ${TABLE}."_SDC_RECEIVED_AT" ;; 52 | } 53 | 54 | dimension: _sdc_sequence { 55 | type: number 56 | sql: ${TABLE}."_SDC_SEQUENCE" ;; 57 | } 58 | 59 | dimension: _sdc_table_version { 60 | type: number 61 | sql: ${TABLE}."_SDC_TABLE_VERSION" ;; 62 | } 63 | 64 | dimension: description { 65 | type: string 66 | sql: ${TABLE}."DESCRIPTION" ;; 67 | } 68 | 69 | dimension: domain { 70 | type: string 71 | sql: ${TABLE}."DOMAIN" ;; 72 | } 73 | 74 | dimension: footer_logo { 75 | type: number 76 | sql: ${TABLE}."FOOTER_LOGO" ;; 77 | } 78 | 79 | dimension: header_logo { 80 | type: number 81 | sql: ${TABLE}."HEADER_LOGO" ;; 82 | } 83 | 84 | dimension: internal_note { 85 | type: string 86 | sql: ${TABLE}."INTERNAL_NOTE" ;; 87 | } 88 | 89 | dimension: logo_url { 90 | type: string 91 | sql: ${TABLE}."LOGO_URL" ;; 92 | } 93 | 94 | dimension: name { 95 | type: string 96 | sql: ${TABLE}."NAME" ;; 97 | } 98 | 99 | dimension: short_name { 100 | type: string 101 | sql: REGEXP_REPLACE(LOWER(${name}), '( & | )', '_') ;; 102 | } 103 | 104 | dimension: secondary_logo_url { 105 | type: string 106 | sql: ${TABLE}."SECONDARY_LOGO_URL" ;; 107 | } 108 | 109 | dimension: shortcut { 110 | type: string 111 | sql: ${TABLE}."SHORTCUT" ;; 112 | } 113 | 114 | dimension: tos { 115 | type: string 116 | sql: ${TABLE}."TOS" ;; 117 | } 118 | 119 | dimension: url_slug { 120 | type: string 121 | sql: ${TABLE}."URL_SLUG" ;; 122 | } 123 | 124 | measure: count { 125 | type: count 126 | drill_fields: [id, name] 127 | } 128 | } 129 | -------------------------------------------------------------------------------- /bridge/retail_store.view.lkml: -------------------------------------------------------------------------------- 1 | view: retail_store_bridge { 2 | sql_table_name: "BRIDGE"."RETAIL_STORE" 3 | ;; 4 | 5 | dimension_group: _sdc_batched { 6 | type: time 7 | timeframes: [ 8 | raw, 9 | time, 10 | date, 11 | week, 12 | month, 13 | quarter, 14 | year 15 | ] 16 | sql: ${TABLE}."_SDC_BATCHED_AT" ;; 17 | } 18 | 19 | dimension_group: _sdc_extracted { 20 | type: time 21 | timeframes: [ 22 | raw, 23 | time, 24 | date, 25 | week, 26 | month, 27 | quarter, 28 | year 29 | ] 30 | sql: ${TABLE}."_SDC_EXTRACTED_AT" ;; 31 | } 32 | 33 | dimension_group: _sdc_received { 34 | type: time 35 | timeframes: [ 36 | raw, 37 | time, 38 | date, 39 | week, 40 | month, 41 | quarter, 42 | year 43 | ] 44 | sql: ${TABLE}."_SDC_RECEIVED_AT" ;; 45 | } 46 | 47 | dimension: _sdc_sequence { 48 | type: number 49 | sql: ${TABLE}."_SDC_SEQUENCE" ;; 50 | } 51 | 52 | dimension: _sdc_table_version { 53 | type: number 54 | sql: ${TABLE}."_SDC_TABLE_VERSION" ;; 55 | } 56 | 57 | dimension: delivery_zones { 58 | type: string 59 | sql: ${TABLE}."DELIVERY_ZONES" ;; 60 | } 61 | 62 | dimension: drink_revision { 63 | type: number 64 | sql: ${TABLE}."DRINK_REVISION" ;; 65 | } 66 | 67 | dimension: extid_auto_create_tasks { 68 | type: yesno 69 | sql: ${TABLE}."EXTID_AUTO_CREATE_TASKS" ;; 70 | } 71 | 72 | dimension: logo_url { 73 | type: string 74 | sql: ${TABLE}."LOGO_URL" ;; 75 | } 76 | 77 | dimension: orders_enabled { 78 | type: yesno 79 | sql: ${TABLE}."ORDERS_ENABLED" ;; 80 | } 81 | 82 | dimension: pos_create_tasks { 83 | type: yesno 84 | sql: ${TABLE}."POS_CREATE_TASKS" ;; 85 | } 86 | 87 | dimension: restaurant_id { 88 | type: number 89 | sql: ${TABLE}."RESTAURANT_ID" ;; 90 | } 91 | 92 | dimension: trim_checkdigit { 93 | type: yesno 94 | sql: ${TABLE}."TRIM_CHECKDIGIT" ;; 95 | } 96 | 97 | dimension: trim_leadzeros { 98 | type: yesno 99 | sql: ${TABLE}."TRIM_LEADZEROS" ;; 100 | } 101 | 102 | dimension: upload_labels { 103 | type: yesno 104 | sql: ${TABLE}."UPLOAD_LABELS" ;; 105 | } 106 | 107 | dimension: virtual_group_id { 108 | type: number 109 | sql: ${TABLE}."VIRTUAL_GROUP_ID" ;; 110 | } 111 | 112 | dimension: wine_revision { 113 | type: number 114 | sql: ${TABLE}."WINE_REVISION" ;; 115 | } 116 | 117 | dimension: working_hours { 118 | type: string 119 | sql: ${TABLE}."WORKING_HOURS" ;; 120 | } 121 | 122 | measure: count { 123 | type: count 124 | drill_fields: [] 125 | } 126 | } 127 | -------------------------------------------------------------------------------- /drync/users.view.lkml: -------------------------------------------------------------------------------- 1 | view: users_drync { 2 | sql_table_name: production.production.users ;; 3 | 4 | dimension: id { 5 | primary_key: yes 6 | type: number 7 | sql: ${TABLE}.id ;; 8 | } 9 | 10 | dimension: email { 11 | type: string 12 | sql: ${TABLE}.email ;; 13 | } 14 | 15 | dimension: first_name { 16 | type: string 17 | sql: ${TABLE}.first_name ;; 18 | } 19 | 20 | dimension: last_name { 21 | type: string 22 | sql: ${TABLE}.last_name ;; 23 | } 24 | 25 | dimension: birth_year { 26 | type: number 27 | sql: ${TABLE}.birth_year ;; 28 | } 29 | 30 | dimension: age { 31 | type: number 32 | sql: extract(year from current_date) - ${birth_year} ;; 33 | } 34 | 35 | dimension: gender_for_ndt { 36 | hidden: yes 37 | sql: ${gender} ;; 38 | } 39 | 40 | dimension: gender { 41 | type: string 42 | case: { 43 | when: { 44 | label: "Male" 45 | sql: ${TABLE}.gender = 'm' ;; 46 | } 47 | when: { 48 | label: "Female" 49 | sql: ${TABLE}.gender = 'f' ;; 50 | } 51 | else: "N/A" 52 | } 53 | } 54 | 55 | dimension: generation { 56 | type: string 57 | case: { 58 | when: { 59 | label: "Mature" 60 | sql: ${birth_year} < 1946;; 61 | } 62 | when: { 63 | label: "Baby Boomer" 64 | sql: ${birth_year} >= 1946 AND ${birth_year} <= 1964;; 65 | } 66 | when: { 67 | label: "Generation X" 68 | sql: ${birth_year} > 1964 AND ${birth_year} <= 1980;; 69 | } 70 | when: { 71 | label: "Millennial" 72 | sql: ${birth_year} > 1980 AND ${birth_year} <= 2000;; 73 | } 74 | else: "Undefined" 75 | } 76 | } 77 | 78 | dimension: country { 79 | type: string 80 | sql: ${TABLE}.country ;; 81 | } 82 | 83 | dimension: state { 84 | type: string 85 | sql: ${TABLE}.state ;; 86 | map_layer_name: us_states 87 | } 88 | 89 | dimension: zipcode { 90 | type: string 91 | sql: ${TABLE}.zipcode ;; 92 | map_layer_name: us_zipcode_tabulation_areas 93 | } 94 | 95 | measure: count { 96 | type: count 97 | drill_fields: [email, last_name, birth_year, age, generation, products.brand, products.name, products.category, products.subcategory] 98 | } 99 | 100 | measure: count_distinct { 101 | type: count_distinct 102 | sql_distinct_key: ${id} ;; 103 | sql: ${id} ;; 104 | drill_fields: [email, last_name, birth_year, age, generation, products.brand, products.name, products.category, products.subcategory] 105 | } 106 | 107 | measure: percentage { 108 | type: percent_of_total 109 | sql: ${count} ;; 110 | drill_fields: [email, last_name, birth_year, age, generation, products.brand, products.name, products.category, products.subcategory] 111 | } 112 | } 113 | -------------------------------------------------------------------------------- /tipsi/derived_views/products.view.lkml: -------------------------------------------------------------------------------- 1 | view: products_tipsi { 2 | derived_table: { 3 | sql: select r.id, w.id as product_id, 'wine' as drink_or_wine, w.name as name, r.in_stock as quantity, r.unit_size as size, 4 as category, v.name as style, brand.name as brand 4 | from tipsi.public.retail_retailinventory r 5 | inner join tipsi.public.api_winetbl w on w.id = r.wine_id 6 | inner join tipsi.public.api_varietal v on v.id = w.varietal_id 7 | inner join tipsi.public.api_winery brand on brand.id = w.winery_id 8 | 9 | union 10 | 11 | select r.id, d.id as product_id, 'drink' as drink_or_wine, d.name as name, r.in_stock as quantity, r.unit_size as size, d.drink_type as category, t.name as style, p.name as brand 12 | from tipsi.public.retail_retailinventory r 13 | inner join tipsi.public.vendor_drink d on d.id = r.drink_id 14 | inner join tipsi.public.vendor_drinkproducer p on p.id = d.producer_id 15 | inner join tipsi.public.vendor_drinktag t on t.id = d.tag_id;; 16 | } 17 | 18 | set: detail { 19 | fields: [id, product_id, name, brand, category, subcategory, variant, size] 20 | } 21 | 22 | dimension: id { 23 | primary_key: yes 24 | type: number 25 | sql: ${TABLE}.id ;; 26 | } 27 | 28 | dimension: drink_or_wine {hidden:yes} 29 | 30 | dimension: product_id { 31 | type: string 32 | sql: ${TABLE}.product_id ;; 33 | } 34 | 35 | dimension: brand { 36 | type: string 37 | sql:${TABLE}.brand ;; 38 | link: { 39 | label: "brand" 40 | url: "?Brand={{value}}" 41 | } 42 | } 43 | 44 | dimension: name { 45 | type: string 46 | sql: ${TABLE}.name ;; 47 | } 48 | 49 | dimension: variant { 50 | type: string 51 | sql: ${TABLE}.quantity::string || ' ' || ${TABLE}.size;; 52 | } 53 | 54 | dimension: size { 55 | type: string 56 | sql: ${TABLE}.size ;; 57 | } 58 | 59 | # dimension: size_oz { 60 | # type: number 61 | # sql: CASE 62 | # WHEN regexp_instr(size, '(oz|o)') > 0 THEN CAST(REGEXP_REPLACE(size, '(oz|o)') AS FLOAT) 63 | # WHEN CHARINDEX('ml', size) > 0 THEN CAST(REPLACE(size, 'ml') AS FLOAT)/29.574 64 | # WHEN CHARINDEX('gal', size) > 0 THEN CAST(REPLACE(size, 'gal') AS FLOAT) * 128 65 | # WHEN regexp_instr(size, '(l|L|liter)') > 0 THEN CAST(REGEXP_REPLACE(size, '(l|L|liter)') AS FLOAT) * 33.814 66 | # ELSE 1 END;; 67 | # } 68 | 69 | dimension: category { 70 | type: string 71 | sql: 72 | case when ${TABLE}.category = 1 then 'Beer' 73 | when ${TABLE}.category = 2 then 'Spirit' 74 | when ${TABLE}.category = 4 then 'Wine' 75 | else 'Other' 76 | end;; 77 | } 78 | 79 | dimension: subcategory { 80 | type: string 81 | sql: ${TABLE}.style ;; 82 | } 83 | 84 | measure: count { 85 | type: count 86 | drill_fields: [detail*] 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /bridge/derived_views/products.view.lkml: -------------------------------------------------------------------------------- 1 | view: products_bridge { 2 | derived_table: { 3 | sql: select r.id, w.id as product_id, 'wine' as drink_or_wine, w.name as name, r.in_stock as quantity, r.unit_size as size, 4 as category, v.name as style, brand.name as brand 4 | from production.bridge.retail_retailinventory r 5 | inner join production.bridge.api_winetbl w on w.id = r.wine_id 6 | inner join production.bridge.api_varietal v on v.id = w.varietal_id 7 | inner join production.bridge.api_winery brand on brand.id = w.winery_id 8 | 9 | union 10 | 11 | select r.id, d.id as product_id, 'drink' as drink_or_wine, d.name as name, r.in_stock as quantity, r.unit_size as size, d.drink_type as category, t.name as style, p.name as brand 12 | from production.bridge.retail_retailinventory r 13 | inner join production.bridge.vendor_drink d on d.id = r.drink_id 14 | inner join production.bridge.vendor_drinkproducer p on p.id = d.producer_id 15 | inner join production.bridge.vendor_drinktag t on t.id = d.tag_id;; 16 | } 17 | 18 | set: detail { 19 | fields: [id, product_id, name, brand, category, subcategory, variant, size] 20 | } 21 | 22 | dimension: id { 23 | primary_key: yes 24 | type: number 25 | sql: ${TABLE}.id ;; 26 | } 27 | 28 | dimension: drink_or_wine {hidden:yes} 29 | 30 | dimension: product_id { 31 | type: string 32 | sql: ${TABLE}.product_id ;; 33 | } 34 | 35 | dimension: brand { 36 | type: string 37 | sql:${TABLE}.brand ;; 38 | link: { 39 | label: "brand" 40 | url: "?Brand={{value}}" 41 | } 42 | } 43 | 44 | dimension: name { 45 | type: string 46 | sql: ${TABLE}.name ;; 47 | } 48 | 49 | dimension: variant { 50 | type: string 51 | sql: ${TABLE}.quantity::string || ' ' || ${TABLE}.size;; 52 | } 53 | 54 | dimension: size { 55 | type: string 56 | sql: ${TABLE}.size ;; 57 | } 58 | 59 | # dimension: size_oz { 60 | # type: number 61 | # sql: CASE 62 | # WHEN regexp_instr(size, '(oz|o)') > 0 THEN CAST(REGEXP_REPLACE(size, '(oz|o)') AS FLOAT) 63 | # WHEN CHARINDEX('ml', size) > 0 THEN CAST(REPLACE(size, 'ml') AS FLOAT)/29.574 64 | # WHEN CHARINDEX('gal', size) > 0 THEN CAST(REPLACE(size, 'gal') AS FLOAT) * 128 65 | # WHEN regexp_instr(size, '(l|L|liter)') > 0 THEN CAST(REGEXP_REPLACE(size, '(l|L|liter)') AS FLOAT) * 33.814 66 | # ELSE 1 END;; 67 | # } 68 | 69 | dimension: category { 70 | type: string 71 | sql: 72 | case when ${TABLE}.category = 1 then 'Beer' 73 | when ${TABLE}.category = 2 then 'Spirit' 74 | when ${TABLE}.category = 4 then 'Wine' 75 | else 'Other' 76 | end;; 77 | } 78 | 79 | dimension: subcategory { 80 | type: string 81 | sql: ${TABLE}.style ;; 82 | } 83 | 84 | measure: count { 85 | type: count 86 | drill_fields: [detail*] 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /tipsi/views/order_orderproduct.view.lkml: -------------------------------------------------------------------------------- 1 | view: order_orderproduct { 2 | sql_table_name: TIPSI.PUBLIC.ORDER_ORDERPRODUCT ;; 3 | drill_fields: [id] 4 | 5 | dimension: id { 6 | primary_key: yes 7 | type: number 8 | sql: ${TABLE}."ID" ;; 9 | } 10 | 11 | dimension: barcodes { 12 | type: string 13 | sql: ${TABLE}."BARCODES" ;; 14 | } 15 | 16 | dimension: quantity { 17 | type: number 18 | sql: ${TABLE}."COUNT" ;; 19 | } 20 | 21 | measure: total_quantity { 22 | type: sum 23 | sql: ${quantity} ;; 24 | description: "Needs to be confirmed if count_raw is quantity" 25 | } 26 | 27 | dimension_group: created { 28 | type: time 29 | timeframes: [ 30 | raw, 31 | time, 32 | date, 33 | week, 34 | month, 35 | quarter, 36 | year 37 | ] 38 | sql: ${TABLE}."CREATED" ;; 39 | } 40 | 41 | dimension: discount_long_text { 42 | type: string 43 | sql: ${TABLE}."DISCOUNT_LONG_TEXT" ;; 44 | } 45 | 46 | dimension: discount_percent { 47 | type: number 48 | sql: ${TABLE}."DISCOUNT_PERCENT" /100 ;; 49 | value_format_name: percent_0 50 | } 51 | 52 | dimension: discount_per_bottle { 53 | type: number 54 | sql: ${discount_percent} * ${price_per_bottle} ;; 55 | } 56 | 57 | dimension: discount_short_text { 58 | type: string 59 | sql: ${TABLE}."DISCOUNT_SHORT_TEXT" ;; 60 | } 61 | 62 | dimension: discount_type { 63 | type: string 64 | sql: ${TABLE}."DISCOUNT_TYPE" ;; 65 | } 66 | 67 | dimension: drink_id { 68 | type: number 69 | sql: ${TABLE}."DRINK_ID" ;; 70 | } 71 | 72 | dimension: external_id { 73 | type: string 74 | sql: ${TABLE}."EXTERNAL_ID" ;; 75 | } 76 | 77 | dimension: inventory_id { 78 | type: number 79 | sql: ${TABLE}."INVENTORY_ID" ;; 80 | } 81 | 82 | dimension: name { 83 | type: string 84 | sql: ${TABLE}."NAME" ;; 85 | } 86 | 87 | dimension: order_id { 88 | type: number 89 | sql: ${TABLE}."ORDER_ID" ;; 90 | } 91 | 92 | dimension: price_per_bottle { 93 | type: number 94 | sql: ${total_price} /nullif(${quantity}, 0) ;; 95 | } 96 | 97 | dimension: total_price { 98 | type: number 99 | sql: ${TABLE}."TOTAL_PRICE" ;; 100 | } 101 | 102 | dimension_group: updated { 103 | type: time 104 | timeframes: [ 105 | raw, 106 | time, 107 | date, 108 | week, 109 | month, 110 | quarter, 111 | year 112 | ] 113 | sql: ${TABLE}."UPDATED" ;; 114 | } 115 | 116 | dimension: wine_id { 117 | type: number 118 | sql: ${TABLE}."WINE_ID" ;; 119 | } 120 | 121 | dimension: bottle_id { 122 | type: string 123 | sql: CASE 124 | WHEN ${wine_id} is null THEN ${drink_id} 125 | WHEN ${drink_id} is null THEN ${wine_id} 126 | ELSE NULL END;; 127 | } 128 | 129 | measure: count { 130 | type: count 131 | drill_fields: [id, name] 132 | } 133 | } 134 | -------------------------------------------------------------------------------- /drync/devices.view.lkml: -------------------------------------------------------------------------------- 1 | view: devices_drync { 2 | sql_table_name: PRODUCTION.DEVICES ;; 3 | drill_fields: [device_identifier] 4 | 5 | dimension: device_identifier { 6 | primary_key: yes 7 | type: string 8 | sql: ${TABLE}."DEVICE_IDENTIFIER" ;; 9 | } 10 | 11 | dimension_group: _sdc_batched { 12 | type: time 13 | timeframes: [ 14 | raw, 15 | time, 16 | date, 17 | week, 18 | month, 19 | quarter, 20 | year 21 | ] 22 | sql: ${TABLE}."_SDC_BATCHED_AT" ;; 23 | } 24 | 25 | dimension_group: _sdc_extracted { 26 | type: time 27 | timeframes: [ 28 | raw, 29 | time, 30 | date, 31 | week, 32 | month, 33 | quarter, 34 | year 35 | ] 36 | sql: ${TABLE}."_SDC_EXTRACTED_AT" ;; 37 | } 38 | 39 | dimension_group: _sdc_received { 40 | type: time 41 | timeframes: [ 42 | raw, 43 | time, 44 | date, 45 | week, 46 | month, 47 | quarter, 48 | year 49 | ] 50 | sql: ${TABLE}."_SDC_RECEIVED_AT" ;; 51 | } 52 | 53 | dimension: _sdc_sequence { 54 | type: number 55 | sql: ${TABLE}."_SDC_SEQUENCE" ;; 56 | } 57 | 58 | dimension: _sdc_table_version { 59 | type: number 60 | sql: ${TABLE}."_SDC_TABLE_VERSION" ;; 61 | } 62 | 63 | dimension: admob_registered { 64 | type: yesno 65 | sql: ${TABLE}."ADMOB_REGISTERED" ;; 66 | } 67 | 68 | dimension_group: created { 69 | type: time 70 | timeframes: [ 71 | raw, 72 | time, 73 | date, 74 | week, 75 | month, 76 | quarter, 77 | year 78 | ] 79 | sql: ${TABLE}."CREATED_AT" ;; 80 | } 81 | 82 | dimension_group: deleted { 83 | type: time 84 | timeframes: [ 85 | raw, 86 | time, 87 | date, 88 | week, 89 | month, 90 | quarter, 91 | year 92 | ] 93 | sql: ${TABLE}."DELETED_AT" ;; 94 | } 95 | 96 | dimension: form_factor { 97 | type: string 98 | sql: ${TABLE}."FORM_FACTOR" ;; 99 | } 100 | 101 | dimension: id { 102 | type: number 103 | sql: ${TABLE}."ID" ;; 104 | } 105 | 106 | dimension: model { 107 | type: string 108 | sql: ${TABLE}."MODEL" ;; 109 | } 110 | 111 | dimension: os_version_major { 112 | type: number 113 | sql: ${TABLE}."OS_VERSION_MAJOR" ;; 114 | } 115 | 116 | dimension: os_version_minor { 117 | type: number 118 | sql: ${TABLE}."OS_VERSION_MINOR" ;; 119 | } 120 | 121 | dimension: os_version_patch { 122 | type: number 123 | sql: ${TABLE}."OS_VERSION_PATCH" ;; 124 | } 125 | 126 | dimension: platform { 127 | type: string 128 | sql: ${TABLE}."PLATFORM" ;; 129 | } 130 | 131 | dimension: push_notification_token { 132 | type: string 133 | sql: ${TABLE}."PUSH_NOTIFICATION_TOKEN" ;; 134 | } 135 | 136 | dimension_group: updated { 137 | type: time 138 | timeframes: [ 139 | raw, 140 | time, 141 | date, 142 | week, 143 | month, 144 | quarter, 145 | year 146 | ] 147 | sql: ${TABLE}."UPDATED_AT" ;; 148 | } 149 | 150 | dimension: user_id { 151 | type: number 152 | sql: ${TABLE}.user_id ;; 153 | } 154 | 155 | measure: count { 156 | type: count 157 | drill_fields: [device_identifier] 158 | } 159 | } 160 | -------------------------------------------------------------------------------- /tipsi/views/order_order.view.lkml: -------------------------------------------------------------------------------- 1 | view: order_order { 2 | sql_table_name: TIPSI.PUBLIC.ORDER_ORDER ;; 3 | 4 | 5 | set: detail { 6 | fields: [id, created_date, total_count, store_id, user_id] 7 | } 8 | 9 | dimension: id { 10 | primary_key: yes 11 | type: number 12 | sql: ${TABLE}."ID" ;; 13 | } 14 | 15 | dimension: code { 16 | type: string 17 | sql: ${TABLE}."CODE" ;; 18 | } 19 | 20 | dimension_group: created { 21 | type: time 22 | timeframes: [ 23 | raw, 24 | time, 25 | date, 26 | week, 27 | month, 28 | quarter, 29 | year 30 | ] 31 | sql: ${TABLE}."CREATED" ;; 32 | } 33 | 34 | dimension: delivery_info { 35 | type: string 36 | sql: ${TABLE}."DELIVERY_INFO" ;; 37 | } 38 | 39 | dimension: delivery_price { 40 | type: number 41 | sql: ${TABLE}."DELIVERY_PRICE" ;; 42 | } 43 | 44 | dimension: delivery_tax { 45 | type: number 46 | sql: ${TABLE}."DELIVERY_TAX" ;; 47 | } 48 | 49 | dimension: delivery_type { 50 | type: number 51 | sql: ${TABLE}."DELIVERY_TYPE" ;; 52 | } 53 | 54 | dimension: email { 55 | type: string 56 | sql: ${TABLE}."EMAIL" ;; 57 | } 58 | 59 | dimension: group_id { 60 | type: number 61 | sql: ${TABLE}."GROUP_ID" ;; 62 | } 63 | 64 | dimension: order_status { 65 | type: string 66 | sql: ${TABLE}."ORDER_STATUS"::varchar;; 67 | } 68 | 69 | dimension_group: payment { 70 | type: time 71 | timeframes: [ 72 | raw, 73 | time, 74 | date, 75 | week, 76 | month, 77 | quarter, 78 | year 79 | ] 80 | sql: ${TABLE}."PAYMENT_DATE" ;; 81 | } 82 | 83 | dimension: payment_status { 84 | type: number 85 | sql: ${TABLE}."PAYMENT_STATUS" ;; 86 | } 87 | 88 | dimension: products_discount { 89 | type: number 90 | sql: ${TABLE}."PRODUCTS_DISCOUNT" ;; 91 | } 92 | 93 | dimension: products_price { 94 | type: number 95 | sql: ${TABLE}."PRODUCTS_PRICE" ;; 96 | } 97 | 98 | dimension: products_tax { 99 | type: number 100 | sql: ${TABLE}."PRODUCTS_TAX" ;; 101 | } 102 | 103 | dimension: search_idx { 104 | type: string 105 | sql: ${TABLE}."SEARCH_IDX" ;; 106 | } 107 | 108 | dimension: shopping_hint_description { 109 | type: string 110 | sql: ${TABLE}."SHOPPING_HINT_DESCRIPTION" ;; 111 | } 112 | 113 | dimension: shopping_hint_title { 114 | type: string 115 | sql: ${TABLE}."SHOPPING_HINT_TITLE" ;; 116 | } 117 | 118 | dimension: store_id { 119 | type: number 120 | sql: ${TABLE}."STORE_ID" ;; 121 | } 122 | 123 | dimension: total_count { 124 | type: number 125 | sql: ${TABLE}."TOTAL_COUNT" ;; 126 | } 127 | 128 | dimension: total_price { 129 | type: number 130 | sql: ${TABLE}."TOTAL_PRICE" ;; 131 | } 132 | 133 | dimension: actual_order_price { 134 | type: number 135 | sql: 0 ;; 136 | } 137 | 138 | dimension_group: updated { 139 | type: time 140 | timeframes: [ 141 | raw, 142 | time, 143 | date, 144 | week, 145 | month, 146 | quarter, 147 | year 148 | ] 149 | sql: ${TABLE}."UPDATED" ;; 150 | } 151 | 152 | dimension: user_id { 153 | type: number 154 | sql: ${TABLE}."USER_ID" ;; 155 | } 156 | 157 | measure: count { 158 | type: count 159 | drill_fields: [id] 160 | } 161 | } 162 | -------------------------------------------------------------------------------- /tipsi/views/tipsi_auth_user.view.lkml: -------------------------------------------------------------------------------- 1 | view: tipsi_auth_user { 2 | sql_table_name: TIPSI.PUBLIC.TIPSI_AUTH_USER ;; 3 | drill_fields: [id] 4 | 5 | dimension: id { 6 | primary_key: yes 7 | type: number 8 | sql: ${TABLE}."ID" ;; 9 | } 10 | 11 | dimension_group: birth { 12 | type: time 13 | timeframes: [ 14 | raw, 15 | date, 16 | week, 17 | month, 18 | quarter, 19 | year 20 | ] 21 | convert_tz: no 22 | datatype: date 23 | sql: ${TABLE}."BIRTH_DATE" ;; 24 | } 25 | 26 | dimension: birth_year_number { 27 | type: number 28 | sql: ${birth_year::number} ;; 29 | } 30 | 31 | dimension: age { 32 | type: number 33 | sql: extract(year from current_date) - ${birth_year} ;; 34 | } 35 | 36 | dimension: generation { 37 | type: string 38 | case: { 39 | when: { 40 | label: "Mature" 41 | sql: ${birth_year} < 1946;; 42 | } 43 | when: { 44 | label: "Baby Boomer" 45 | sql: ${birth_year} >= 1946 AND ${birth_year} <= 1964;; 46 | } 47 | when: { 48 | label: "Generation X" 49 | sql: ${birth_year} > 1964 AND ${birth_year} <= 1980;; 50 | } 51 | when: { 52 | label: "Millennial" 53 | sql: ${birth_year} > 1980 AND ${birth_year} <= 2000;; 54 | } 55 | else: "Undefined" 56 | } 57 | } 58 | 59 | dimension: data { 60 | type: string 61 | sql: ${TABLE}."DATA" ;; 62 | } 63 | 64 | dimension_group: date_joined { 65 | type: time 66 | timeframes: [ 67 | raw, 68 | time, 69 | date, 70 | week, 71 | month, 72 | quarter, 73 | year 74 | ] 75 | sql: ${TABLE}."DATE_JOINED" ;; 76 | } 77 | 78 | dimension: email { 79 | type: string 80 | sql: ${TABLE}."EMAIL" ;; 81 | } 82 | 83 | dimension: first_name { 84 | type: string 85 | sql: ${TABLE}."FIRST_NAME" ;; 86 | } 87 | 88 | dimension: group_id { 89 | type: number 90 | sql: ${TABLE}."GROUP_ID" ;; 91 | } 92 | 93 | dimension: is_active { 94 | type: yesno 95 | sql: ${TABLE}."IS_ACTIVE" ;; 96 | } 97 | 98 | dimension: is_staff { 99 | type: yesno 100 | sql: ${TABLE}."IS_STAFF" ;; 101 | } 102 | 103 | dimension: is_superuser { 104 | type: yesno 105 | sql: ${TABLE}."IS_SUPERUSER" ;; 106 | } 107 | 108 | dimension_group: last_login { 109 | type: time 110 | timeframes: [ 111 | raw, 112 | time, 113 | date, 114 | week, 115 | month, 116 | quarter, 117 | year 118 | ] 119 | sql: ${TABLE}."LAST_LOGIN" ;; 120 | } 121 | 122 | dimension: last_name { 123 | type: string 124 | sql: ${TABLE}."LAST_NAME" ;; 125 | } 126 | 127 | dimension: password { 128 | type: string 129 | sql: ${TABLE}."PASSWORD" ;; 130 | } 131 | 132 | dimension: temporary { 133 | type: yesno 134 | sql: ${TABLE}."TEMPORARY" ;; 135 | } 136 | 137 | dimension: token { 138 | type: string 139 | sql: ${TABLE}."TOKEN" ;; 140 | } 141 | 142 | dimension: username { 143 | type: string 144 | sql: ${TABLE}."USERNAME" ;; 145 | } 146 | 147 | dimension: gender { 148 | type: string 149 | sql: null ;; 150 | } 151 | 152 | measure: count { 153 | type: count 154 | drill_fields: [id, username, first_name, last_name, password, group_id, generation, birth_date, last_login_date, is_active, token, 155 | age, is_staff, data] 156 | } 157 | } 158 | -------------------------------------------------------------------------------- /bridge/vendor_drink.view.lkml: -------------------------------------------------------------------------------- 1 | view: vendor_drink_bridge { 2 | sql_table_name: "BRIDGE"."VENDOR_DRINK" 3 | ;; 4 | drill_fields: [id] 5 | 6 | dimension: id { 7 | primary_key: yes 8 | type: number 9 | sql: ${TABLE}."ID" ;; 10 | } 11 | 12 | dimension_group: _sdc_batched { 13 | type: time 14 | timeframes: [ 15 | raw, 16 | time, 17 | date, 18 | week, 19 | month, 20 | quarter, 21 | year 22 | ] 23 | sql: ${TABLE}."_SDC_BATCHED_AT" ;; 24 | } 25 | 26 | dimension_group: _sdc_extracted { 27 | type: time 28 | timeframes: [ 29 | raw, 30 | time, 31 | date, 32 | week, 33 | month, 34 | quarter, 35 | year 36 | ] 37 | sql: ${TABLE}."_SDC_EXTRACTED_AT" ;; 38 | } 39 | 40 | dimension_group: _sdc_received { 41 | type: time 42 | timeframes: [ 43 | raw, 44 | time, 45 | date, 46 | week, 47 | month, 48 | quarter, 49 | year 50 | ] 51 | sql: ${TABLE}."_SDC_RECEIVED_AT" ;; 52 | } 53 | 54 | dimension: _sdc_sequence { 55 | type: number 56 | sql: ${TABLE}."_SDC_SEQUENCE" ;; 57 | } 58 | 59 | dimension: _sdc_table_version { 60 | type: number 61 | sql: ${TABLE}."_SDC_TABLE_VERSION" ;; 62 | } 63 | 64 | dimension: country_id { 65 | type: number 66 | sql: ${TABLE}."COUNTRY_ID" ;; 67 | } 68 | 69 | dimension_group: created { 70 | type: time 71 | timeframes: [ 72 | raw, 73 | time, 74 | date, 75 | week, 76 | month, 77 | quarter, 78 | year 79 | ] 80 | sql: ${TABLE}."CREATED" ;; 81 | } 82 | 83 | dimension: description { 84 | type: string 85 | sql: ${TABLE}."DESCRIPTION" ;; 86 | } 87 | 88 | dimension: drink_type_raw { 89 | type: number 90 | hidden: yes 91 | sql: ${TABLE}."DRINK_TYPE" ;; 92 | } 93 | 94 | dimension: drink_type { 95 | type: string 96 | case: { 97 | when: { 98 | label: "Other" 99 | sql: ${drink_type_raw} = 0 ;; 100 | } 101 | when: { 102 | label: "Beer" 103 | sql: ${drink_type_raw} = 1 ;; 104 | } 105 | when: { 106 | label: "Spirit" 107 | sql: ${drink_type_raw} = 2 ;; 108 | } 109 | when: { 110 | label: "Cocktail" 111 | sql: ${drink_type_raw} = 3 ;; 112 | } 113 | else: "Other" 114 | } 115 | } 116 | 117 | dimension: label_url { 118 | type: string 119 | sql: ${TABLE}."LABEL_URL" ;; 120 | } 121 | 122 | dimension: name { 123 | type: string 124 | sql: ${TABLE}."NAME" ;; 125 | } 126 | 127 | dimension: producer_id { 128 | type: number 129 | sql: ${TABLE}."PRODUCER_ID" ;; 130 | } 131 | 132 | dimension: tag_id { 133 | type: number 134 | sql: ${TABLE}."TAG_ID" ;; 135 | } 136 | 137 | dimension: thumb_list_url { 138 | type: string 139 | sql: ${TABLE}."THUMB_LIST_URL" ;; 140 | } 141 | 142 | dimension: thumb_product_url { 143 | type: string 144 | sql: ${TABLE}."THUMB_PRODUCT_URL" ;; 145 | } 146 | 147 | dimension_group: updated { 148 | type: time 149 | timeframes: [ 150 | raw, 151 | time, 152 | date, 153 | week, 154 | month, 155 | quarter, 156 | year 157 | ] 158 | sql: ${TABLE}."UPDATED" ;; 159 | } 160 | 161 | dimension: validated { 162 | type: yesno 163 | sql: ${TABLE}."VALIDATED" ;; 164 | } 165 | 166 | measure: count { 167 | type: count 168 | drill_fields: [id, name, description, drink_type] 169 | } 170 | } 171 | -------------------------------------------------------------------------------- /tipsi/views/retail_retailinventory.view.lkml: -------------------------------------------------------------------------------- 1 | view: retail_retailinventory { 2 | sql_table_name: TIPSI.PUBLIC.RETAIL_RETAILINVENTORY ;; 3 | drill_fields: [id] 4 | 5 | dimension: id { 6 | primary_key: yes 7 | type: number 8 | sql: ${TABLE}."ID" ;; 9 | } 10 | 11 | dimension: abv { 12 | type: number 13 | sql: ${TABLE}."ABV" ;; 14 | } 15 | 16 | dimension: barcodes { 17 | type: string 18 | sql: ${TABLE}."BARCODES" ;; 19 | } 20 | 21 | dimension: batch_price { 22 | type: string 23 | sql: ${TABLE}."BATCH_PRICE" ;; 24 | } 25 | 26 | dimension: connoisseur_pick { 27 | type: yesno 28 | sql: ${TABLE}."CONNOISSEUR_PICK" ;; 29 | } 30 | 31 | dimension_group: created { 32 | type: time 33 | timeframes: [ 34 | raw, 35 | time, 36 | date, 37 | week, 38 | month, 39 | quarter, 40 | year 41 | ] 42 | sql: ${TABLE}."CREATED" ;; 43 | } 44 | 45 | dimension: drink_id { 46 | type: number 47 | sql: ${TABLE}."DRINK_ID" ;; 48 | } 49 | 50 | dimension: drink_id_is_null { 51 | type: yesno 52 | sql: ${drink_id} is null ;; 53 | } 54 | 55 | dimension: external_id { 56 | type: string 57 | sql: ${TABLE}."EXTERNAL_ID" ;; 58 | } 59 | 60 | dimension: extra { 61 | type: string 62 | sql: ${TABLE}."EXTRA" ;; 63 | } 64 | 65 | dimension: in_stock { 66 | type: number 67 | sql: ${TABLE}."IN_STOCK" ;; 68 | } 69 | 70 | dimension: location { 71 | type: string 72 | sql: ${TABLE}."LOCATION" ;; 73 | } 74 | 75 | dimension: note { 76 | type: string 77 | sql: ${TABLE}."NOTE" ;; 78 | } 79 | 80 | dimension: old_price { 81 | type: number 82 | sql: ${TABLE}."OLD_PRICE" ;; 83 | } 84 | 85 | dimension: on_sale { 86 | type: yesno 87 | sql: ${TABLE}."ON_SALE" ;; 88 | } 89 | 90 | dimension: ordering { 91 | type: number 92 | sql: ${TABLE}."ORDERING" ;; 93 | } 94 | 95 | dimension: pack_size { 96 | type: number 97 | sql: ${TABLE}."PACK_SIZE" ;; 98 | } 99 | 100 | dimension: parent_id { 101 | type: number 102 | sql: ${TABLE}."PARENT_ID" ;; 103 | } 104 | 105 | dimension: price { 106 | type: number 107 | sql: ${TABLE}."PRICE" ;; 108 | } 109 | 110 | dimension: proof { 111 | type: number 112 | sql: ${TABLE}."PROOF" ;; 113 | } 114 | 115 | dimension: staff_pick { 116 | type: yesno 117 | sql: ${TABLE}."STAFF_PICK" ;; 118 | } 119 | 120 | dimension: status { 121 | type: number 122 | sql: ${TABLE}."STATUS" ;; 123 | } 124 | 125 | dimension: store_id { 126 | type: number 127 | sql: ${TABLE}."STORE_ID" ;; 128 | } 129 | 130 | dimension: task_id { 131 | type: number 132 | sql: ${TABLE}."TASK_ID" ;; 133 | } 134 | 135 | dimension: unit_size { 136 | type: string 137 | sql: ${TABLE}."UNIT_SIZE" ;; 138 | } 139 | 140 | dimension_group: updated { 141 | type: time 142 | timeframes: [ 143 | raw, 144 | time, 145 | date, 146 | week, 147 | month, 148 | quarter, 149 | year 150 | ] 151 | sql: ${TABLE}."UPDATED" ;; 152 | } 153 | 154 | dimension: visible { 155 | type: yesno 156 | sql: ${TABLE}."VISIBLE" ;; 157 | } 158 | 159 | dimension: wine_id { 160 | type: number 161 | sql: ${TABLE}."WINE_ID" ;; 162 | } 163 | 164 | dimension: wine_id_is_null { 165 | type: yesno 166 | sql: ${wine_id} is null ;; 167 | } 168 | 169 | measure: count { 170 | type: count 171 | drill_fields: [id, note, proof, abv, drink_id, wine_id] 172 | } 173 | } -------------------------------------------------------------------------------- /tipsi/views/core_restaurant.view.lkml: -------------------------------------------------------------------------------- 1 | view: core_restaurant { 2 | sql_table_name: TIPSI.PUBLIC.CORE_RESTAURANT ;; 3 | drill_fields: [id] 4 | 5 | dimension: id { 6 | primary_key: yes 7 | type: number 8 | sql: ${TABLE}.id ;; 9 | } 10 | 11 | dimension: address { 12 | type: string 13 | sql: ${TABLE}."address" ;; 14 | } 15 | 16 | dimension: city { 17 | type: string 18 | sql: ${TABLE}."city" ;; 19 | } 20 | 21 | dimension: code { 22 | type: string 23 | sql: ${TABLE}."code" ;; 24 | } 25 | 26 | dimension: comment { 27 | type: string 28 | sql: ${TABLE}."comment" ;; 29 | } 30 | 31 | dimension: country { 32 | type: string 33 | map_layer_name: countries 34 | sql: ${TABLE}."country" ;; 35 | } 36 | 37 | dimension: enabled { 38 | type: yesno 39 | sql: ${TABLE}."enabled" ;; 40 | } 41 | 42 | dimension: external_id { 43 | type: string 44 | sql: ${TABLE}."external_id" ;; 45 | } 46 | 47 | dimension: had_menu { 48 | type: yesno 49 | sql: ${TABLE}."had_menu" ;; 50 | } 51 | 52 | dimension: location { 53 | type: string 54 | sql: ${TABLE}."location" ;; 55 | } 56 | 57 | dimension: location_area_id { 58 | type: number 59 | sql: ${TABLE}."location_area_id" ;; 60 | } 61 | 62 | dimension: menupages_urls { 63 | type: string 64 | sql: ${TABLE}."menupages_urls" ;; 65 | } 66 | 67 | dimension: name { 68 | type: string 69 | sql: ${TABLE}."name" ;; 70 | } 71 | 72 | dimension: neighborhood { 73 | type: string 74 | sql: ${TABLE}."neighborhood" ;; 75 | } 76 | 77 | dimension: ordered_menu { 78 | type: yesno 79 | sql: ${TABLE}."ordered_menu" ;; 80 | } 81 | 82 | dimension: phone_number { 83 | type: string 84 | sql: ${TABLE}."phone_number" ;; 85 | } 86 | 87 | dimension: popularity { 88 | type: number 89 | sql: ${TABLE}."popularity" ;; 90 | } 91 | 92 | dimension: postcode { 93 | type: string 94 | sql: ${TABLE}."postcode" ;; 95 | } 96 | 97 | dimension: price_rating { 98 | type: number 99 | sql: ${TABLE}."price_rating" ;; 100 | } 101 | 102 | dimension: reviewed { 103 | type: yesno 104 | sql: ${TABLE}."reviewed" ;; 105 | } 106 | 107 | dimension: reviewed_by_id { 108 | type: number 109 | sql: ${TABLE}."reviewed_by_id" ;; 110 | } 111 | 112 | dimension: source { 113 | type: string 114 | sql: ${TABLE}."source" ;; 115 | } 116 | 117 | dimension_group: timestamp_added { 118 | type: time 119 | timeframes: [ 120 | raw, 121 | time, 122 | date, 123 | week, 124 | month, 125 | quarter, 126 | year 127 | ] 128 | sql: ${TABLE}."timestamp_added" ;; 129 | } 130 | 131 | dimension_group: timestamp_reprocessed { 132 | type: time 133 | timeframes: [ 134 | raw, 135 | time, 136 | date, 137 | week, 138 | month, 139 | quarter, 140 | year 141 | ] 142 | sql: ${TABLE}."timestamp_reprocessed" ;; 143 | } 144 | 145 | dimension_group: timestamp_updated { 146 | type: time 147 | timeframes: [ 148 | raw, 149 | time, 150 | date, 151 | week, 152 | month, 153 | quarter, 154 | year 155 | ] 156 | sql: ${TABLE}."timestamp_updated" ;; 157 | } 158 | 159 | dimension: type { 160 | type: number 161 | sql: ${TABLE}."type" ;; 162 | } 163 | 164 | dimension: website { 165 | type: string 166 | sql: ${TABLE}."website" ;; 167 | } 168 | 169 | measure: count { 170 | type: count 171 | drill_fields: [id, name] 172 | } 173 | } 174 | -------------------------------------------------------------------------------- /drync/app_sessions.view.lkml: -------------------------------------------------------------------------------- 1 | view: app_sessions { 2 | sql_table_name: PRODUCTION.APP_SESSIONS ;; 3 | drill_fields: [id] 4 | 5 | dimension: id { 6 | primary_key: yes 7 | type: number 8 | sql: ${TABLE}."ID" ;; 9 | } 10 | 11 | dimension_group: _sdc_batched { 12 | type: time 13 | timeframes: [ 14 | raw, 15 | time, 16 | date, 17 | week, 18 | month, 19 | quarter, 20 | year 21 | ] 22 | sql: ${TABLE}."_SDC_BATCHED_AT" ;; 23 | } 24 | 25 | dimension_group: _sdc_extracted { 26 | type: time 27 | timeframes: [ 28 | raw, 29 | time, 30 | date, 31 | week, 32 | month, 33 | quarter, 34 | year 35 | ] 36 | sql: ${TABLE}."_SDC_EXTRACTED_AT" ;; 37 | } 38 | 39 | dimension_group: _sdc_received { 40 | type: time 41 | timeframes: [ 42 | raw, 43 | time, 44 | date, 45 | week, 46 | month, 47 | quarter, 48 | year 49 | ] 50 | sql: ${TABLE}."_SDC_RECEIVED_AT" ;; 51 | } 52 | 53 | dimension: _sdc_sequence { 54 | type: number 55 | sql: ${TABLE}."_SDC_SEQUENCE" ;; 56 | } 57 | 58 | dimension: _sdc_table_version { 59 | type: number 60 | sql: ${TABLE}."_SDC_TABLE_VERSION" ;; 61 | } 62 | 63 | dimension: accuracy { 64 | type: number 65 | sql: ${TABLE}."ACCURACY" ;; 66 | } 67 | 68 | dimension: app_id { 69 | type: number 70 | # hidden: yes 71 | sql: ${TABLE}."APP_ID" ;; 72 | } 73 | 74 | dimension: app_registration_id { 75 | type: number 76 | # hidden: yes 77 | sql: ${TABLE}."APP_REGISTRATION_ID" ;; 78 | } 79 | 80 | dimension_group: created { 81 | type: time 82 | timeframes: [ 83 | raw, 84 | time, 85 | date, 86 | week, 87 | month, 88 | quarter, 89 | year 90 | ] 91 | sql: ${TABLE}."CREATED_AT" ;; 92 | } 93 | 94 | dimension: device_id { 95 | type: number 96 | sql: ${TABLE}."DEVICE_ID" ;; 97 | } 98 | 99 | dimension: email { 100 | type: string 101 | sql: ${TABLE}."EMAIL" ;; 102 | } 103 | 104 | dimension: latitude { 105 | type: number 106 | sql: ${TABLE}."LATITUDE" ;; 107 | } 108 | 109 | dimension: longitude { 110 | type: number 111 | sql: ${TABLE}."LONGITUDE" ;; 112 | } 113 | 114 | dimension: motd_type { 115 | type: string 116 | sql: ${TABLE}."MOTD_TYPE" ;; 117 | } 118 | 119 | dimension: offer_id { 120 | type: number 121 | sql: ${TABLE}."OFFER_ID" ;; 122 | } 123 | 124 | dimension: phone { 125 | type: string 126 | sql: ${TABLE}."PHONE" ;; 127 | } 128 | 129 | dimension: result { 130 | type: string 131 | sql: ${TABLE}."RESULT" ;; 132 | } 133 | 134 | dimension: timezone { 135 | type: string 136 | sql: ${TABLE}."TIMEZONE" ;; 137 | } 138 | 139 | dimension_group: updated { 140 | type: time 141 | timeframes: [ 142 | raw, 143 | time, 144 | date, 145 | week, 146 | month, 147 | quarter, 148 | year 149 | ] 150 | sql: ${TABLE}."UPDATED_AT" ;; 151 | } 152 | 153 | dimension: user_id { 154 | type: number 155 | sql: ${TABLE}."USER_ID" ;; 156 | } 157 | 158 | dimension: version { 159 | type: string 160 | sql: ${TABLE}."VERSION" ;; 161 | } 162 | 163 | measure: count { 164 | type: count 165 | drill_fields: [detail*] 166 | } 167 | 168 | # ----- Sets of fields for drilling ------ 169 | set: detail { 170 | fields: [ 171 | id, 172 | app_registrations.id, 173 | apps.mailchimp_list_name, 174 | apps.name, 175 | apps.short_name, 176 | apps.id 177 | ] 178 | } 179 | } 180 | -------------------------------------------------------------------------------- /drync/organizations.view.lkml: -------------------------------------------------------------------------------- 1 | view: organizations_drync { 2 | sql_table_name: production.production.organizations;; 3 | 4 | dimension: id { 5 | primary_key: yes #https://dryncapp.looker.com/sql/qhbyy3ysgvznmq 6 | hidden: yes 7 | type: number 8 | sql: ${TABLE}."ID" ;; 9 | } 10 | 11 | measure: count { 12 | type: count 13 | drill_fields: [detail*] 14 | } 15 | 16 | dimension_group: created_at { 17 | type: time 18 | sql: ${TABLE}."CREATED_AT" ;; 19 | } 20 | 21 | dimension: customer_contact_email { 22 | type: string 23 | sql: ${TABLE}."CUSTOMER_CONTACT_EMAIL" ;; 24 | } 25 | 26 | dimension: loyalty_card_enabled { 27 | type: string 28 | sql: ${TABLE}."LOYALTY_CARD_ENABLED" ;; 29 | } 30 | 31 | dimension: loyalty_card_name { 32 | type: string 33 | sql: ${TABLE}."LOYALTY_CARD_NAME" ;; 34 | } 35 | 36 | dimension: name { 37 | type: string 38 | sql: ${TABLE}."NAME" ;; 39 | } 40 | 41 | measure: distinct_retailers { 42 | description: "Count of distinct retailer brands" 43 | type: count_distinct 44 | sql: ${name} ;; 45 | } 46 | 47 | dimension: shipping_cost_base { 48 | type: number 49 | sql: ${TABLE}."SHIPPING_COST_BASE" ;; 50 | } 51 | 52 | dimension: shipping_cost_per_item { 53 | type: number 54 | sql: ${TABLE}."SHIPPING_COST_PER_ITEM" ;; 55 | } 56 | 57 | dimension: short_name { 58 | type: string 59 | sql: ${TABLE}."SHORT_NAME" ;; 60 | } 61 | 62 | dimension_group: updated_at { 63 | type: time 64 | sql: ${TABLE}."UPDATED_AT" ;; 65 | } 66 | 67 | dimension: use_chartio { 68 | type: string 69 | sql: ${TABLE}."USE_CHARTIO" ;; 70 | } 71 | 72 | dimension: use_drync_description { 73 | type: string 74 | sql: ${TABLE}."USE_DRYNC_DESCRIPTION" ;; 75 | } 76 | 77 | dimension: use_drync_image { 78 | type: string 79 | sql: ${TABLE}."USE_DRYNC_IMAGE" ;; 80 | } 81 | 82 | dimension: use_drync_review { 83 | type: string 84 | sql: ${TABLE}."USE_DRYNC_REVIEW" ;; 85 | } 86 | 87 | dimension: use_my_description { 88 | type: string 89 | sql: ${TABLE}."USE_MY_DESCRIPTION" ;; 90 | } 91 | 92 | dimension: use_my_image { 93 | type: string 94 | sql: ${TABLE}."USE_MY_IMAGE" ;; 95 | } 96 | 97 | dimension: use_my_review { 98 | type: string 99 | sql: ${TABLE}."USE_MY_REVIEW" ;; 100 | } 101 | 102 | dimension_group: _sdc_batched_at { 103 | type: time 104 | sql: ${TABLE}."_SDC_BATCHED_AT" ;; 105 | } 106 | 107 | dimension_group: _sdc_extracted_at { 108 | type: time 109 | sql: ${TABLE}."_SDC_EXTRACTED_AT" ;; 110 | } 111 | 112 | dimension_group: _sdc_received_at { 113 | type: time 114 | sql: ${TABLE}."_SDC_RECEIVED_AT" ;; 115 | } 116 | 117 | dimension: _sdc_sequence { 118 | type: number 119 | sql: ${TABLE}."_SDC_SEQUENCE" ;; 120 | } 121 | 122 | dimension: _sdc_table_version { 123 | type: number 124 | sql: ${TABLE}."_SDC_TABLE_VERSION" ;; 125 | } 126 | 127 | set: detail { 128 | fields: [ 129 | created_at_time, 130 | customer_contact_email, 131 | id, 132 | loyalty_card_enabled, 133 | loyalty_card_name, 134 | name, 135 | shipping_cost_base, 136 | shipping_cost_per_item, 137 | short_name, 138 | updated_at_time, 139 | use_chartio, 140 | use_drync_description, 141 | use_drync_image, 142 | use_drync_review, 143 | use_my_description, 144 | use_my_image, 145 | use_my_review, 146 | _sdc_batched_at_time, 147 | _sdc_extracted_at_time, 148 | _sdc_received_at_time, 149 | _sdc_sequence, 150 | _sdc_table_version 151 | ] 152 | } 153 | } 154 | -------------------------------------------------------------------------------- /bridge/order_orderproduct.view.lkml: -------------------------------------------------------------------------------- 1 | view: order_orderproduct_bridge { 2 | sql_table_name: "BRIDGE_ORDERS"."ORDER_ORDERPRODUCT" 3 | ;; 4 | drill_fields: [id] 5 | 6 | dimension: id { 7 | primary_key: yes 8 | type: number 9 | sql: ${TABLE}."ID" ;; 10 | } 11 | 12 | dimension_group: _sdc_batched { 13 | type: time 14 | timeframes: [ 15 | raw, 16 | time, 17 | date, 18 | week, 19 | month, 20 | quarter, 21 | year 22 | ] 23 | sql: ${TABLE}."_SDC_BATCHED_AT" ;; 24 | } 25 | 26 | dimension_group: _sdc_extracted { 27 | type: time 28 | timeframes: [ 29 | raw, 30 | time, 31 | date, 32 | week, 33 | month, 34 | quarter, 35 | year 36 | ] 37 | sql: ${TABLE}."_SDC_EXTRACTED_AT" ;; 38 | } 39 | 40 | dimension_group: _sdc_received { 41 | type: time 42 | timeframes: [ 43 | raw, 44 | time, 45 | date, 46 | week, 47 | month, 48 | quarter, 49 | year 50 | ] 51 | sql: ${TABLE}."_SDC_RECEIVED_AT" ;; 52 | } 53 | 54 | dimension: _sdc_sequence { 55 | type: number 56 | sql: ${TABLE}."_SDC_SEQUENCE" ;; 57 | } 58 | 59 | dimension: _sdc_table_version { 60 | type: number 61 | sql: ${TABLE}."_SDC_TABLE_VERSION" ;; 62 | } 63 | 64 | dimension: barcodes { 65 | type: string 66 | sql: ${TABLE}."BARCODES" ;; 67 | } 68 | 69 | # Change name to not conflict with 'count' measure 70 | dimension: quantity { 71 | type: number 72 | sql: ${TABLE}."COUNT" ;; 73 | } 74 | 75 | dimension_group: created { 76 | type: time 77 | timeframes: [ 78 | raw, 79 | time, 80 | date, 81 | week, 82 | month, 83 | quarter, 84 | year 85 | ] 86 | sql: ${TABLE}."CREATED" ;; 87 | } 88 | 89 | dimension: discount_long_text { 90 | type: string 91 | sql: ${TABLE}."DISCOUNT_LONG_TEXT" ;; 92 | } 93 | 94 | dimension: discount_percent { 95 | type: number 96 | sql: ${TABLE}."DISCOUNT_PERCENT" ;; 97 | } 98 | 99 | dimension: discount_per_bottle { 100 | type: number 101 | sql: ${discount_percent} * ${price_per_bottle} ;; 102 | } 103 | 104 | dimension: discount_short_text { 105 | type: string 106 | sql: ${TABLE}."DISCOUNT_SHORT_TEXT" ;; 107 | } 108 | 109 | dimension: discount_type { 110 | type: string 111 | sql: ${TABLE}."DISCOUNT_TYPE" ;; 112 | } 113 | 114 | dimension: drink_id { 115 | type: number 116 | sql: ${TABLE}."DRINK_ID" ;; 117 | } 118 | 119 | dimension: external_id { 120 | type: string 121 | sql: ${TABLE}."EXTERNAL_ID" ;; 122 | } 123 | 124 | dimension: inventory_id { 125 | type: number 126 | sql: ${TABLE}."INVENTORY_ID" ;; 127 | } 128 | 129 | dimension: name { 130 | type: string 131 | sql: ${TABLE}."NAME" ;; 132 | } 133 | 134 | dimension: order_id { 135 | type: number 136 | sql: ${TABLE}."ORDER_ID" ;; 137 | } 138 | 139 | dimension: price_per_bottle { 140 | type: number 141 | sql: ${total_price} /nullif(${quantity}, 0) ;; 142 | } 143 | 144 | dimension: total_price { 145 | type: number 146 | sql: ${TABLE}."TOTAL_PRICE" ;; 147 | } 148 | 149 | dimension_group: updated { 150 | type: time 151 | timeframes: [ 152 | raw, 153 | time, 154 | date, 155 | week, 156 | month, 157 | quarter, 158 | year 159 | ] 160 | sql: ${TABLE}."UPDATED" ;; 161 | } 162 | 163 | dimension: wine_id { 164 | type: number 165 | sql: ${TABLE}."WINE_ID" ;; 166 | } 167 | 168 | dimension: bottle_id { 169 | type: string 170 | sql: CASE 171 | WHEN ${wine_id} is null THEN ${drink_id} 172 | WHEN ${drink_id} is null THEN ${wine_id} 173 | ELSE NULL END;; 174 | } 175 | 176 | } 177 | -------------------------------------------------------------------------------- /bridge/tipsi_auth_user.view.lkml: -------------------------------------------------------------------------------- 1 | view: tipsi_auth_user_bridge { 2 | sql_table_name: "BRIDGE"."TIPSI_AUTH_USER" 3 | ;; 4 | drill_fields: [id] 5 | 6 | dimension: id { 7 | primary_key: yes 8 | type: number 9 | sql: ${TABLE}."ID" ;; 10 | } 11 | 12 | dimension_group: _sdc_batched { 13 | type: time 14 | timeframes: [ 15 | raw, 16 | time, 17 | date, 18 | week, 19 | month, 20 | quarter, 21 | year 22 | ] 23 | sql: ${TABLE}."_SDC_BATCHED_AT" ;; 24 | } 25 | 26 | dimension_group: _sdc_extracted { 27 | type: time 28 | timeframes: [ 29 | raw, 30 | time, 31 | date, 32 | week, 33 | month, 34 | quarter, 35 | year 36 | ] 37 | sql: ${TABLE}."_SDC_EXTRACTED_AT" ;; 38 | } 39 | 40 | dimension_group: _sdc_received { 41 | type: time 42 | timeframes: [ 43 | raw, 44 | time, 45 | date, 46 | week, 47 | month, 48 | quarter, 49 | year 50 | ] 51 | sql: ${TABLE}."_SDC_RECEIVED_AT" ;; 52 | } 53 | 54 | dimension: _sdc_sequence { 55 | type: number 56 | sql: ${TABLE}."_SDC_SEQUENCE" ;; 57 | } 58 | 59 | dimension: _sdc_table_version { 60 | type: number 61 | sql: ${TABLE}."_SDC_TABLE_VERSION" ;; 62 | } 63 | 64 | dimension_group: birth { 65 | type: time 66 | timeframes: [ 67 | raw, 68 | time, 69 | date, 70 | week, 71 | month, 72 | quarter, 73 | year 74 | ] 75 | sql: ${TABLE}."BIRTH_DATE" ;; 76 | } 77 | 78 | dimension: birth_year_number { 79 | type: number 80 | sql: ${birth_year::number} ;; 81 | } 82 | 83 | dimension: age { 84 | type: number 85 | sql: extract(year from current_date) - ${birth_year} ;; 86 | } 87 | 88 | dimension: data { 89 | type: string 90 | sql: ${TABLE}."DATA" ;; 91 | } 92 | 93 | dimension_group: date_joined { 94 | type: time 95 | timeframes: [ 96 | raw, 97 | time, 98 | date, 99 | week, 100 | month, 101 | quarter, 102 | year 103 | ] 104 | sql: ${TABLE}."DATE_JOINED" ;; 105 | } 106 | 107 | dimension: email { 108 | type: string 109 | sql: ${TABLE}."EMAIL" ;; 110 | } 111 | 112 | dimension: gender { 113 | type: string 114 | sql: null ;; 115 | } 116 | 117 | dimension: first_name { 118 | type: string 119 | sql: ${TABLE}."FIRST_NAME" ;; 120 | } 121 | 122 | dimension: group_id { 123 | type: number 124 | sql: ${TABLE}."GROUP_ID" ;; 125 | } 126 | 127 | dimension: is_active { 128 | type: yesno 129 | sql: ${TABLE}."IS_ACTIVE" ;; 130 | } 131 | 132 | dimension: is_staff { 133 | type: yesno 134 | sql: ${TABLE}."IS_STAFF" ;; 135 | } 136 | 137 | dimension: is_superuser { 138 | type: yesno 139 | sql: ${TABLE}."IS_SUPERUSER" ;; 140 | } 141 | 142 | dimension_group: last_login { 143 | type: time 144 | timeframes: [ 145 | raw, 146 | time, 147 | date, 148 | week, 149 | month, 150 | quarter, 151 | year 152 | ] 153 | sql: ${TABLE}."LAST_LOGIN" ;; 154 | } 155 | 156 | dimension: last_name { 157 | type: string 158 | sql: ${TABLE}."LAST_NAME" ;; 159 | } 160 | 161 | dimension: password { 162 | type: string 163 | sql: ${TABLE}."PASSWORD" ;; 164 | } 165 | 166 | dimension: store_id { 167 | type: number 168 | sql: ${TABLE}."STORE_ID" ;; 169 | } 170 | 171 | dimension: temporary { 172 | type: yesno 173 | sql: ${TABLE}."TEMPORARY" ;; 174 | } 175 | 176 | dimension: token { 177 | type: string 178 | sql: ${TABLE}."TOKEN" ;; 179 | } 180 | 181 | dimension: user_role { 182 | type: number 183 | sql: ${TABLE}."USER_ROLE" ;; 184 | } 185 | 186 | dimension: username { 187 | type: string 188 | sql: ${TABLE}."USERNAME" ;; 189 | } 190 | 191 | measure: count { 192 | type: count 193 | drill_fields: [id, username, first_name, last_name] 194 | } 195 | } 196 | -------------------------------------------------------------------------------- /drync/products.view.lkml: -------------------------------------------------------------------------------- 1 | view: products_drync { 2 | derived_table: { 3 | # datagroup_trigger: bridge_default 4 | sql: select b.id, w.id as product_id, w.name as name, p.quantity as quantity, p.size as size, p.type as type, s.style_type as category, s.name as style, br.name as brand 5 | from production.production.bottles b 6 | inner join production.production.wines w on w.id = b.wine_id 7 | inner join production.production.packagings p on p.id = b.packaging_id 8 | inner join production.production.wineries br on br.id = w.winery_id 9 | inner join production.production.wine_styles s on w.wine_style_id = s.id 10 | ;; 11 | } 12 | 13 | set: detail { 14 | fields: [id, name, brand, category, subcategory] 15 | } 16 | 17 | dimension: id { 18 | primary_key: yes 19 | type: number 20 | sql: ${TABLE}.id ;; 21 | } 22 | 23 | dimension: product_id { 24 | type: number 25 | sql: ${TABLE}.product_id ;; 26 | } 27 | 28 | dimension: bridge_product_id { 29 | type: string 30 | sql: ${product_id}::string ;; 31 | } 32 | 33 | dimension: brand { 34 | type: string 35 | sql:${TABLE}.brand ;; 36 | link: { 37 | label: "brand" 38 | url: "?Brand={{value}}" 39 | } 40 | } 41 | 42 | dimension: cleaned_brand_name { 43 | type: string 44 | sql: REGEXP_REPLACE(${brand}, '(,|\')', '') ;; 45 | } 46 | 47 | dimension: name { 48 | type: string 49 | sql: ${TABLE}.name ;; 50 | } 51 | 52 | dimension: cleaned_name { 53 | type: string 54 | sql: REGEXP_REPLACE(${name}, '(,|\')', '') ;; 55 | } 56 | 57 | dimension: variant { 58 | type: string 59 | sql: ${TABLE}.quantity::string || ' ' || ${TABLE}.size || ' ' || ${TABLE}.type ;; 60 | } 61 | 62 | dimension: size { 63 | type: string 64 | sql: ${TABLE}.size ;; 65 | } 66 | 67 | dimension: size_oz { 68 | type: number 69 | sql: CASE 70 | WHEN regexp_instr(size, '(oz|o)') > 0 THEN CAST(REGEXP_REPLACE(size, '(oz|o)') AS FLOAT) 71 | WHEN CHARINDEX('ml', size) > 0 THEN CAST(REPLACE(size, 'ml') AS FLOAT)/29.574 72 | WHEN CHARINDEX('gal', size) > 0 THEN CAST(REPLACE(size, 'gal') AS FLOAT) * 128 73 | WHEN regexp_instr(size, '(l|L|liter)') > 0 THEN CAST(REGEXP_REPLACE(size, '(l|L|liter)') AS FLOAT) * 33.814 74 | ELSE 1 END;; 75 | } 76 | 77 | dimension: category { 78 | type: string 79 | sql: 80 | case when ${TABLE}.category = 'beer' then 'Beer' 81 | when ${TABLE}.category = 'wine' then 'Wine' 82 | when ${TABLE}.category = 'spirits' then 'Spirit' 83 | else 'Other' 84 | end;; 85 | } 86 | 87 | dimension: subcategory { 88 | type: string 89 | sql: ${TABLE}.style ;; 90 | } 91 | # 4 ndt { 92 | dimension: brand_id { 93 | sql: ${brand} ;; 94 | hidden: yes 95 | } 96 | dimension: department_id { 97 | sql: ${brand} ;; 98 | hidden: yes 99 | } 100 | dimension: department_name { 101 | sql: ${brand} ;; 102 | hidden: yes 103 | } 104 | 105 | measure: count { 106 | type: count 107 | } 108 | 109 | measure: count_distinct_brands { 110 | type: count_distinct 111 | sql: ${cleaned_brand_name} ;; 112 | } 113 | #} 114 | # derived_table: { 115 | # explore_source: line_items { 116 | # column: transaction_id { field: shipments.order_id } 117 | # column: order_created_time { field: orders.created_time } 118 | # column: SKU_id { field: products_drync.id } 119 | # column: SKU_name { field: products_drync.name } 120 | # column: brand_id { field: products_drync.brand } 121 | # column: brand_name { field: products_drync.brand } 122 | # column: department_id { field: products_drync.brand } 123 | # column: department_name { field: products_drync.brand } 124 | # column: user_id { field: orders.user_id } 125 | # column: sale_amt { field: orders.sale_price } 126 | # column: margin_amt { field: orders.sale_price } 127 | # } 128 | } 129 | -------------------------------------------------------------------------------- /united/united.model.lkml: -------------------------------------------------------------------------------- 1 | connection: "warehouse2" 2 | 3 | include: "*.view.lkml" 4 | include: "../tipsi/tipsi.explore.view" 5 | include: "../drync/drync.explore.view" 6 | include: "../bridge/bridge.explore.view" 7 | include: "../throtle/*.view" 8 | include: "../affinity/affinity_analysis.view" 9 | include: "../affinity/item_affinity_analysis.dashboard" 10 | 11 | explore: users { 12 | group_label: "⭐ United" 13 | description: "Start here to analyze purchasing history from Drync, Tipsi, and Bridge" 14 | join: attributes { 15 | type: inner 16 | sql_on: ${users.source_id} = ${attributes.id} ;; 17 | relationship: one_to_many 18 | } 19 | join: attributes_extended { 20 | type: inner 21 | sql_on: ${users.source_id} = ${attributes_extended.id} ;; 22 | relationship: one_to_many 23 | } 24 | join: orders_united { 25 | type: left_outer 26 | sql_on: ${users.source_id} = ${orders_united.source_user_id} ;; 27 | relationship: many_to_many 28 | } 29 | join: order_product_united { 30 | type: left_outer 31 | sql_on: ${orders_united.source_id} = ${order_product_united.source_order_id} ;; #need to use a product id in left table to join 32 | relationship: one_to_many 33 | } 34 | join: products_united { 35 | type: left_outer 36 | sql_on: ${order_product_united.source_bottle_id} = ${products_united.source_product_id} ;; 37 | relationship: one_to_many 38 | } 39 | } 40 | 41 | explore: products_united { 42 | group_label: "⭐ United" 43 | label: "Products" 44 | } 45 | 46 | # explore: orders_united { 47 | # group_label: "⭐ United" 48 | # label: "Orders" 49 | # sql_always_where: (${orders_united.status} NOT IN ('cancelled','declined') OR ${orders_united.id} IS NULL) ;; 50 | # 51 | # } 52 | 53 | explore: order_product_united { 54 | access_filter: { 55 | field: fulfillers_united.organization_short_name 56 | user_attribute: organization 57 | } 58 | group_label: "⭐ United" 59 | label: " 💰Order Items" 60 | sql_always_where: (${orders_united.status} NOT IN ('cancelled','declined') OR ${orders_united.id} IS NULL) ;; 61 | join: products_united { 62 | type: left_outer 63 | sql_on: ${order_product_united.bottle_id} = 64 | case when order_product_united.source = 'drync' then ${products_united.id} 65 | when order_product_united.source = 'tipsi' then ${products_united.product_id} 66 | else false end 67 | 68 | AND ${products_united.source} = 69 | case when ${orders_united.source}='drync' then 'drync' 70 | when ${orders_united.source}='tipsi' then 'tipsi' 71 | else false end 72 | ;; 73 | relationship: many_to_many #in order to change back to many_to_one, need to detect why this is fanning out from 1 to 48: https://dryncapp.looker.com/explore/bridge/order_product_united?qid=q6xkKWVQOtVrY59hu9gzU7 74 | } 75 | join: orders_united { 76 | type: left_outer 77 | sql_on: ${order_product_united.order_id} = ${orders_united.id} 78 | and ${order_product_united.source} = ${orders_united.source};; 79 | 80 | relationship: many_to_one 81 | } 82 | join: users { 83 | view_label: "Users with Orders" 84 | type: left_outer 85 | sql_on: ${orders_united.source_user_id} = ${users.source_id} ;; 86 | relationship: many_to_one 87 | } 88 | join: attributes { 89 | type: inner 90 | sql_on: ${users.source_id} = ${attributes.id} ;; 91 | relationship: one_to_one 92 | } 93 | join: attributes_extended { 94 | type: inner 95 | sql_on: ${users.source_id} = ${attributes_extended.id} ;; 96 | relationship: many_to_one 97 | } 98 | join: fulfillers_united { 99 | type: inner 100 | sql_on: ${orders_united.store_id} = ${fulfillers_united.fulfiller_id} 101 | and ${order_product_united.source} = ${fulfillers_united.source};; 102 | relationship: many_to_one 103 | } 104 | } 105 | 106 | explore: attributes { 107 | group_label: "⭐ United" 108 | } 109 | 110 | explore: attributes_extended {group_label: "⭐ United"} 111 | 112 | explore: devices_united {group_label: "⭐ United"} 113 | -------------------------------------------------------------------------------- /drync/product_clicked.view.lkml: -------------------------------------------------------------------------------- 1 | view: product_clicked { 2 | derived_table: { 3 | sql: 4 | select c.id, c.product_id, c.user_id, c.timestamp, c.context_os_name, c.price, c.context_traits_fulfiller_id 5 | from segment_events.ios.product_clicked c 6 | inner join production.production.users u ON u.id = c.user_id::int 7 | where u.company_friend = false 8 | 9 | union 10 | 11 | select c.id, c.product_id, c.user_id, c.timestamp, c.context_os_name, c.price, c.context_traits_fulfiller_id 12 | from segment_events.android.product_clicked c 13 | inner join production.production.users u ON u.id = c.user_id::int 14 | where u.company_friend = false;; 15 | } 16 | 17 | dimension: id { 18 | type: string 19 | primary_key: yes 20 | } 21 | 22 | dimension: product_id { 23 | description: "Unique Product ID" 24 | type: number 25 | sql: ${TABLE}.product_id::int ;; 26 | } 27 | 28 | dimension: user_id { 29 | description: "Unique User ID" 30 | type: number 31 | sql: ${TABLE}.user_id::int ;; 32 | } 33 | 34 | dimension: retailer_id { 35 | description: "ID of the retail location" 36 | type: string 37 | sql: ${TABLE}.context_traits_fulfiller_id ;; 38 | } 39 | 40 | dimension_group: event { 41 | description: "Time of the event" 42 | type: time 43 | timeframes: [ 44 | raw, 45 | time, 46 | date, 47 | week, 48 | month, 49 | year, 50 | time_of_day, 51 | day_of_week 52 | ] 53 | sql: ${TABLE}.timestamp ;; 54 | } 55 | 56 | dimension: platform { 57 | description: "User's device platform" 58 | type: string 59 | sql: ${TABLE}.context_os_name ;; 60 | } 61 | 62 | dimension: price { 63 | description: "Price shown to the user" 64 | type: number 65 | sql: REPLACE(${TABLE}.price, ',')::float;; 66 | value_format_name: usd 67 | } 68 | 69 | dimension: price_per_ounce { 70 | type: number 71 | sql: ${price}/NULLIF(${products_drync.size_oz},0) ;; 72 | value_format_name: usd 73 | } 74 | 75 | dimension: price_range { 76 | type: tier 77 | tiers: [ 78 | 15, 20, 30, 50, 100 79 | ] 80 | style: relational 81 | sql: ${price} ;; 82 | value_format_name: usd 83 | } 84 | 85 | dimension: price_tier { 86 | type: string 87 | case: { 88 | when: { 89 | label: "Luxury" 90 | sql: (${products_drync.category} = 'Wine' AND ${price} >= 50) 91 | OR (${products_drync.category} in ('Beer', 'Other') AND ${price} >= 20) 92 | OR (${products_drync.category} = 'Spirit' AND ${price} >= 100);; 93 | } 94 | when: { 95 | label: "Mid Range" 96 | sql: (${products_drync.category} = 'Wine' AND ${price} >= 20 AND ${price} < 50) 97 | OR (${products_drync.category} in ('Beer', 'Other') AND ${price} >= 10 AND ${price} < 20) 98 | OR (${products_drync.category} = 'Spirit' AND ${price} >= 50 and ${price} < 100);; 99 | } 100 | when: { 101 | label: "Value" 102 | sql: (${products_drync.category} = 'Wine' AND ${price} < 20) 103 | OR (${products_drync.category} in ('Beer', 'Other') AND ${price} < 10) 104 | OR (${products_drync.category} = 'Spirit' AND ${price} < 50);; 105 | } 106 | else: "Undefined" 107 | } 108 | } 109 | 110 | dimension_group: occurrence { 111 | type: time 112 | timeframes: [ 113 | date, 114 | week, 115 | month, 116 | quarter 117 | ] 118 | sql: ${TABLE}.timestamp ;; 119 | } 120 | 121 | measure: unique_users { 122 | type: count_distinct 123 | sql_distinct_key: ${user_id} ;; 124 | sql: ${TABLE}.user_id ;; 125 | drill_fields: [products.brand, products.name, products.category, products.subcategory] 126 | } 127 | 128 | measure: count { 129 | type: count 130 | drill_fields: [products.brand, products.name, products.category, products.subcategory, price, price_tier, id, price_range] 131 | } 132 | } 133 | -------------------------------------------------------------------------------- /bridge/retail_retailinventory.view.lkml: -------------------------------------------------------------------------------- 1 | view: retail_retailinventory_bridge { 2 | sql_table_name: "BRIDGE"."RETAIL_RETAILINVENTORY" 3 | ;; 4 | drill_fields: [id] 5 | 6 | dimension: id { 7 | primary_key: yes 8 | type: number 9 | sql: ${TABLE}."ID" ;; 10 | } 11 | 12 | dimension_group: _sdc_batched { 13 | type: time 14 | timeframes: [ 15 | raw, 16 | time, 17 | date, 18 | week, 19 | month, 20 | quarter, 21 | year 22 | ] 23 | sql: ${TABLE}."_SDC_BATCHED_AT" ;; 24 | } 25 | 26 | dimension_group: _sdc_extracted { 27 | type: time 28 | timeframes: [ 29 | raw, 30 | time, 31 | date, 32 | week, 33 | month, 34 | quarter, 35 | year 36 | ] 37 | sql: ${TABLE}."_SDC_EXTRACTED_AT" ;; 38 | } 39 | 40 | dimension_group: _sdc_received { 41 | type: time 42 | timeframes: [ 43 | raw, 44 | time, 45 | date, 46 | week, 47 | month, 48 | quarter, 49 | year 50 | ] 51 | sql: ${TABLE}."_SDC_RECEIVED_AT" ;; 52 | } 53 | 54 | dimension: _sdc_sequence { 55 | type: number 56 | sql: ${TABLE}."_SDC_SEQUENCE" ;; 57 | } 58 | 59 | dimension: _sdc_table_version { 60 | type: number 61 | sql: ${TABLE}."_SDC_TABLE_VERSION" ;; 62 | } 63 | 64 | dimension: barcodes { 65 | type: string 66 | sql: ${TABLE}."BARCODES" ;; 67 | } 68 | 69 | dimension: batch_price { 70 | type: string 71 | sql: ${TABLE}."BATCH_PRICE" ;; 72 | } 73 | 74 | dimension: connoisseur_pick { 75 | type: yesno 76 | sql: ${TABLE}."CONNOISSEUR_PICK" ;; 77 | } 78 | 79 | dimension_group: created { 80 | type: time 81 | timeframes: [ 82 | raw, 83 | time, 84 | date, 85 | week, 86 | month, 87 | quarter, 88 | year 89 | ] 90 | sql: ${TABLE}."CREATED" ;; 91 | } 92 | 93 | dimension: drink_id { 94 | type: number 95 | sql: ${TABLE}."DRINK_ID" ;; 96 | } 97 | 98 | dimension: external_id { 99 | type: string 100 | sql: ${TABLE}."EXTERNAL_ID" ;; 101 | } 102 | 103 | dimension: extra { 104 | type: string 105 | sql: ${TABLE}."EXTRA" ;; 106 | } 107 | 108 | dimension: in_stock { 109 | type: number 110 | sql: ${TABLE}."IN_STOCK" ;; 111 | } 112 | 113 | dimension: note { 114 | type: string 115 | sql: ${TABLE}."NOTE" ;; 116 | } 117 | 118 | dimension: old_price { 119 | type: number 120 | sql: ${TABLE}."OLD_PRICE" ;; 121 | } 122 | 123 | dimension: on_sale { 124 | type: yesno 125 | sql: ${TABLE}."ON_SALE" ;; 126 | } 127 | 128 | dimension: ordering { 129 | type: number 130 | sql: ${TABLE}."ORDERING" ;; 131 | } 132 | 133 | dimension: pack_size { 134 | type: number 135 | sql: ${TABLE}."PACK_SIZE" ;; 136 | } 137 | 138 | dimension: parent_id { 139 | type: number 140 | sql: ${TABLE}."PARENT_ID" ;; 141 | } 142 | 143 | dimension: price { 144 | type: number 145 | sql: ${TABLE}."PRICE" ;; 146 | } 147 | 148 | dimension: staff_pick { 149 | type: yesno 150 | sql: ${TABLE}."STAFF_PICK" ;; 151 | } 152 | 153 | dimension: status { 154 | type: number 155 | sql: ${TABLE}."STATUS" ;; 156 | } 157 | 158 | dimension: store_id { 159 | type: number 160 | sql: ${TABLE}."STORE_ID" ;; 161 | } 162 | 163 | dimension: task_id { 164 | type: number 165 | sql: ${TABLE}."TASK_ID" ;; 166 | } 167 | 168 | dimension: unit_size { 169 | type: string 170 | sql: ${TABLE}."UNIT_SIZE" ;; 171 | } 172 | 173 | dimension_group: updated { 174 | type: time 175 | timeframes: [ 176 | raw, 177 | time, 178 | date, 179 | week, 180 | month, 181 | quarter, 182 | year 183 | ] 184 | sql: ${TABLE}."UPDATED" ;; 185 | } 186 | 187 | dimension: visible { 188 | type: yesno 189 | sql: ${TABLE}."VISIBLE" ;; 190 | } 191 | 192 | dimension: wine_id { 193 | type: number 194 | sql: ${TABLE}."WINE_ID" ;; 195 | } 196 | 197 | measure: count { 198 | type: count 199 | drill_fields: [id] 200 | } 201 | } 202 | -------------------------------------------------------------------------------- /bridge/bridge.explore.view.lkml: -------------------------------------------------------------------------------- 1 | include: "*.view.lkml" 2 | include: "./derived_views/*.view.lkml" 3 | 4 | explore: retail_retailinventory_bridge { 5 | group_label: "Bridge" 6 | join: api_winetbl { 7 | from: api_winetbl_bridge 8 | type: left_outer 9 | sql_on: ${retail_retailinventory_bridge.wine_id} = ${api_winetbl.id} ;; 10 | relationship: many_to_one 11 | } 12 | join: vendor_drink { 13 | from: vendor_drink_bridge 14 | type: left_outer 15 | sql_on: ${retail_retailinventory_bridge.drink_id} = ${vendor_drink.id} ;; 16 | relationship: many_to_one 17 | } 18 | join: vendor_drinkproducer { 19 | from: vendor_drinkproducer_bridge 20 | type: left_outer 21 | sql_on: ${vendor_drink.producer_id} = ${vendor_drinkproducer.id} ;; 22 | relationship: many_to_one 23 | } 24 | join: vendor_drinktag { 25 | from: vendor_drinktag_bridge 26 | type: left_outer 27 | sql_on: ${vendor_drink.tag_id} = ${vendor_drinktag.id} ;; 28 | relationship: many_to_one 29 | } 30 | join: vendor_drinkinventory { 31 | from: vendor_drinkinventory_bridge 32 | type: left_outer 33 | sql_on: ${vendor_drink.id} = ${vendor_drinkinventory.drink_id} ;; 34 | relationship: one_to_many 35 | } 36 | } 37 | 38 | explore: users_bridge { 39 | from: tipsi_auth_user_bridge 40 | group_label: "Bridge" 41 | join: devices { 42 | from: notifications_fcmdevice_bridge 43 | view_label: "Devices" 44 | type: inner 45 | sql_on: ${users_bridge.id} = ${devices.user_id} ;; 46 | relationship: many_to_one 47 | } 48 | join: order_order { 49 | from: order_order_bridge 50 | view_label: "Orders" 51 | type: left_outer 52 | sql_on: ${users_bridge.id} = ${order_order.user_id} ;; 53 | relationship: one_to_many 54 | } 55 | join: order_orderproduct { 56 | from: order_orderproduct_bridge 57 | view_label: "Order Product" 58 | type: left_outer 59 | sql_on: ${order_order.id} = ${order_orderproduct.order_id} ;; 60 | relationship: many_to_one 61 | } 62 | join: vendor_drink { 63 | from: vendor_drink_bridge 64 | view_label: "Drinks" 65 | type: left_outer 66 | sql_on: ${order_orderproduct.drink_id} = ${vendor_drink.id} ;; 67 | relationship: many_to_one 68 | } 69 | join: vendor_drinkproducer { 70 | from: vendor_drinkproducer_bridge 71 | view_label: "Drink Producer" 72 | type: left_outer 73 | sql_on: ${vendor_drink.producer_id} = ${vendor_drinkproducer.id} ;; 74 | relationship: many_to_one 75 | } 76 | join: vendor_drinktag { 77 | from: vendor_drinktag_bridge 78 | view_label: "Drink Tag" 79 | type: left_outer 80 | sql_on: ${vendor_drink.tag_id} = ${vendor_drinktag.id} ;; 81 | relationship: many_to_one 82 | } 83 | join: vendor_drinkinventory { 84 | from: vendor_drinkinventory_bridge 85 | view_label: "Drink Inventory" 86 | type: left_outer 87 | sql_on: ${vendor_drink.id} = ${vendor_drinkinventory.drink_id} ;; 88 | relationship: one_to_many 89 | } 90 | join: api_winetbl { 91 | from: api_winetbl_bridge 92 | view_label: "Wines" 93 | type: left_outer 94 | sql_on: ${order_orderproduct.wine_id} = ${api_winetbl.id} ;; 95 | relationship: many_to_one 96 | } 97 | } 98 | 99 | explore: retail_retailgroup_bridge { 100 | group_label: "Bridge" 101 | join: retail_retailstoregroupthrough_bridge { 102 | type: left_outer 103 | sql_on: ${retail_retailgroup_bridge.id} = ${retail_retailstoregroupthrough_bridge.group_id} ;; 104 | relationship: many_to_one 105 | } 106 | join: core_restaurant_bridge { 107 | type: left_outer 108 | sql_on: ${retail_retailstoregroupthrough_bridge.store_id} = ${core_restaurant_bridge.id} ;; 109 | relationship: many_to_one 110 | } 111 | 112 | } 113 | 114 | # 115 | # explore: products_tipsi { 116 | # group_label: "Tipsi" 117 | # } 118 | # 119 | 120 | explore: products_bridge { 121 | group_label: "Bridge" 122 | } 123 | 124 | explore: order_order_bridge { 125 | group_label: "Bridge" 126 | } 127 | 128 | explore: order_orderproduct_bridge { 129 | group_label: "Bridge" 130 | } 131 | 132 | explore: devices_bridge { 133 | from: notifications_fcmdevice_bridge 134 | group_label: "Bridge" 135 | } 136 | -------------------------------------------------------------------------------- /bridge/order_order.view.lkml: -------------------------------------------------------------------------------- 1 | view: order_order_bridge { 2 | sql_table_name: "BRIDGE_ORDERS"."ORDER_ORDER" 3 | ;; 4 | drill_fields: [id] 5 | 6 | dimension: id { 7 | primary_key: yes 8 | type: number 9 | sql: ${TABLE}."ID" ;; 10 | } 11 | 12 | dimension_group: _sdc_batched { 13 | type: time 14 | timeframes: [ 15 | raw, 16 | time, 17 | date, 18 | week, 19 | month, 20 | quarter, 21 | year 22 | ] 23 | sql: ${TABLE}."_SDC_BATCHED_AT" ;; 24 | } 25 | 26 | dimension_group: _sdc_extracted { 27 | type: time 28 | timeframes: [ 29 | raw, 30 | time, 31 | date, 32 | week, 33 | month, 34 | quarter, 35 | year 36 | ] 37 | sql: ${TABLE}."_SDC_EXTRACTED_AT" ;; 38 | } 39 | 40 | dimension_group: _sdc_received { 41 | type: time 42 | timeframes: [ 43 | raw, 44 | time, 45 | date, 46 | week, 47 | month, 48 | quarter, 49 | year 50 | ] 51 | sql: ${TABLE}."_SDC_RECEIVED_AT" ;; 52 | } 53 | 54 | dimension: _sdc_sequence { 55 | type: number 56 | sql: ${TABLE}."_SDC_SEQUENCE" ;; 57 | } 58 | 59 | dimension: _sdc_table_version { 60 | type: number 61 | sql: ${TABLE}."_SDC_TABLE_VERSION" ;; 62 | } 63 | 64 | dimension: code { 65 | type: string 66 | sql: ${TABLE}."CODE" ;; 67 | } 68 | 69 | dimension_group: created { 70 | type: time 71 | timeframes: [ 72 | raw, 73 | time, 74 | date, 75 | week, 76 | month, 77 | quarter, 78 | year 79 | ] 80 | sql: ${TABLE}."CREATED" ;; 81 | } 82 | 83 | dimension: delivery_info { 84 | type: string 85 | sql: ${TABLE}."DELIVERY_INFO" ;; 86 | } 87 | 88 | dimension: delivery_price { 89 | type: number 90 | sql: ${TABLE}."DELIVERY_PRICE" ;; 91 | } 92 | 93 | dimension: delivery_tax { 94 | type: number 95 | sql: ${TABLE}."DELIVERY_TAX" ;; 96 | } 97 | 98 | dimension: delivery_type { 99 | type: number 100 | sql: ${TABLE}."DELIVERY_TYPE" ;; 101 | } 102 | 103 | dimension: email { 104 | type: string 105 | sql: ${TABLE}."EMAIL" ;; 106 | } 107 | 108 | dimension: group_id { 109 | type: number 110 | sql: ${TABLE}."GROUP_ID" ;; 111 | } 112 | 113 | dimension: order_status { 114 | type: string 115 | sql: ${TABLE}."ORDER_STATUS"::varchar ;; 116 | } 117 | 118 | dimension_group: payment { 119 | type: time 120 | timeframes: [ 121 | raw, 122 | time, 123 | date, 124 | week, 125 | month, 126 | quarter, 127 | year 128 | ] 129 | sql: ${TABLE}."PAYMENT_DATE" ;; 130 | } 131 | 132 | dimension: payment_status { 133 | type: number 134 | sql: ${TABLE}."PAYMENT_STATUS" ;; 135 | } 136 | 137 | dimension: products_discount { 138 | type: number 139 | sql: ${TABLE}."PRODUCTS_DISCOUNT" ;; 140 | } 141 | 142 | dimension: products_price { 143 | type: number 144 | sql: ${TABLE}."PRODUCTS_PRICE" ;; 145 | } 146 | 147 | dimension: products_tax { 148 | type: number 149 | sql: ${TABLE}."PRODUCTS_TAX" ;; 150 | } 151 | 152 | dimension: search_idx { 153 | type: string 154 | sql: ${TABLE}."SEARCH_IDX" ;; 155 | } 156 | 157 | dimension: shopping_hint_title { 158 | type: string 159 | sql: ${TABLE}."SHOPPING_HINT_TITLE" ;; 160 | } 161 | 162 | dimension: store_id { 163 | type: number 164 | sql: ${TABLE}."STORE_ID" ;; 165 | } 166 | 167 | dimension: total_count { 168 | type: number 169 | sql: ${TABLE}."TOTAL_COUNT" ;; 170 | } 171 | 172 | dimension: total_price { 173 | type: number 174 | sql: ${TABLE}."TOTAL_PRICE" ;; 175 | } 176 | 177 | dimension: actual_order_price { 178 | type: number 179 | sql: ${products_price} - ${products_discount} 180 | + ${delivery_price} 181 | + ${delivery_tax} 182 | + ${products_tax} 183 | ;; 184 | } 185 | 186 | dimension_group: updated { 187 | type: time 188 | timeframes: [ 189 | raw, 190 | time, 191 | date, 192 | week, 193 | month, 194 | quarter, 195 | year 196 | ] 197 | sql: ${TABLE}."UPDATED" ;; 198 | } 199 | 200 | dimension: user_id { 201 | type: number 202 | sql: ${TABLE}."USER_ID" ;; 203 | } 204 | 205 | measure: count { 206 | type: count 207 | drill_fields: [id] 208 | } 209 | } 210 | -------------------------------------------------------------------------------- /united/orders.view.lkml: -------------------------------------------------------------------------------- 1 | include: "../drync/drync_united/orders.view.lkml" 2 | include: "../tipsi/tipsi_united/orders.view.lkml" 3 | include: "../bridge/bridge_united/orders.view.lkml" 4 | 5 | 6 | 7 | view: orders_united { 8 | # Or, you could make this view a derived table, like this: 9 | derived_table: { 10 | # datagroup_trigger: bridge_default 11 | sql: SELECT * FROM ${orders_drync_united.SQL_TABLE_NAME} 12 | UNION 13 | SELECT * FROM ${orders_tipsi_united.SQL_TABLE_NAME} 14 | UNION 15 | SELECT * FROM ${orders_bridge_united.SQL_TABLE_NAME} 16 | ;; 17 | } 18 | 19 | dimension: id { 20 | type: number 21 | } 22 | 23 | dimension: source_id { 24 | type: string 25 | primary_key: yes 26 | sql: ${source} || ${id} ;; 27 | } 28 | 29 | 30 | dimension_group: created { 31 | label: "Order Created" 32 | type: time 33 | timeframes: [ 34 | raw, 35 | hour_of_day, 36 | time, 37 | date, 38 | day_of_week, 39 | week, 40 | month, 41 | quarter, 42 | year 43 | ] 44 | sql: ${TABLE}.created_time ;; 45 | } 46 | filter: date_range_filter { 47 | # hidden: yes 48 | type: date 49 | } 50 | dimension_group: until_end_of_date_range_filter { 51 | description: "Do not use this with anything besides timeframe week" 52 | type: duration 53 | timeframes: [week] 54 | sql_start: ${created_week} ;; #do not use this with anything besides timeframe week 55 | sql_end: {% date_end date_range_filter %} ;; 56 | 57 | } 58 | dimension: date_end_of_range_back_12_weeks { 59 | type: yesno 60 | sql: ${weeks_until_end_of_date_range_filter}>0 and ${weeks_until_end_of_date_range_filter}<=12 ;; 61 | } 62 | dimension: gift_recipient { 63 | type: string 64 | } 65 | dimension: source { 66 | type: string 67 | } 68 | # dimension: quantity { 69 | # type: number 70 | # } 71 | dimension: store_id {} 72 | dimension: user_id {} 73 | 74 | dimension: source_user_id { 75 | type: string 76 | sql: ${source} || ${user_id} ;; 77 | } 78 | dimension: status { 79 | type: string 80 | } 81 | dimension: total_price_raw { 82 | label: "Total Price" 83 | type: number 84 | hidden: yes 85 | sql: ${TABLE}.total_price ;; 86 | } 87 | 88 | dimension: actual_order_price { 89 | type: number 90 | value_format_name: usd 91 | } 92 | dimension: payment_method { 93 | sql: case when ${TABLE}.payment_method = 'android_pay' then 'Google Pay' 94 | when ${TABLE}.payment_method = 'apple_pay' then 'Apple Pay' 95 | when ${TABLE}.payment_method = 'card_io' then 'Card IO' 96 | when ${TABLE}.payment_method = 'google_instant_buy' then 'Google Instant Buy' 97 | when ${TABLE}.payment_method = 'stored' then 'Stored' 98 | when ${TABLE}.payment_method = 'typed' then 'Typed' 99 | else ${TABLE}.payment_method end;; 100 | } 101 | dimension: subtotal { 102 | type:number 103 | hidden:yes 104 | } 105 | dimension: deposit { 106 | type:number 107 | hidden:yes 108 | } 109 | dimension: tax { 110 | type:number 111 | hidden:yes 112 | } 113 | dimension: discount { 114 | type:number 115 | hidden:yes 116 | } 117 | measure: total_price { 118 | description: "DO NOT USE! This breaks as soon as the query is grouped by line item or product" 119 | hidden: yes 120 | value_format_name: usd 121 | type: sum 122 | sql: ${total_price_raw} ;; 123 | drill_fields: [id, created_time,source, source_user_id, source_id, total_price_raw] 124 | 125 | } 126 | measure: count { 127 | type: count 128 | drill_fields: [id, created_time,source, source_user_id, source_id] 129 | } 130 | 131 | measure: first_order { 132 | type: date 133 | sql: MIN(${created_time}) ;; 134 | } 135 | 136 | measure: last_order { 137 | type: date 138 | sql: MAX(${created_time}) ;; 139 | } 140 | 141 | measure: distinct_buyers { 142 | type: count_distinct 143 | sql: ${user_id} ;; 144 | } 145 | 146 | measure: lifetime_order_tier { 147 | type: string 148 | case: { 149 | when: { 150 | label: "Gold" 151 | sql: ${count} > 1000;; 152 | } 153 | when: { 154 | label: "Silver" 155 | sql: ${count} > 500;; 156 | } 157 | when: { 158 | label: "Bronze" 159 | sql: ${count} > 100;; 160 | } 161 | } 162 | } 163 | } 164 | -------------------------------------------------------------------------------- /bridge/core_restaurant.view.lkml: -------------------------------------------------------------------------------- 1 | view: core_restaurant_bridge { 2 | sql_table_name: "BRIDGE"."CORE_RESTAURANT" 3 | ;; 4 | drill_fields: [id] 5 | 6 | dimension: id { 7 | primary_key: yes 8 | type: number 9 | sql: ${TABLE}."ID" ;; 10 | } 11 | 12 | dimension_group: _sdc_batched { 13 | type: time 14 | timeframes: [ 15 | raw, 16 | time, 17 | date, 18 | week, 19 | month, 20 | quarter, 21 | year 22 | ] 23 | sql: ${TABLE}."_SDC_BATCHED_AT" ;; 24 | } 25 | 26 | dimension_group: _sdc_extracted { 27 | type: time 28 | timeframes: [ 29 | raw, 30 | time, 31 | date, 32 | week, 33 | month, 34 | quarter, 35 | year 36 | ] 37 | sql: ${TABLE}."_SDC_EXTRACTED_AT" ;; 38 | } 39 | 40 | dimension_group: _sdc_received { 41 | type: time 42 | timeframes: [ 43 | raw, 44 | time, 45 | date, 46 | week, 47 | month, 48 | quarter, 49 | year 50 | ] 51 | sql: ${TABLE}."_SDC_RECEIVED_AT" ;; 52 | } 53 | 54 | dimension: _sdc_sequence { 55 | type: number 56 | sql: ${TABLE}."_SDC_SEQUENCE" ;; 57 | } 58 | 59 | dimension: _sdc_table_version { 60 | type: number 61 | sql: ${TABLE}."_SDC_TABLE_VERSION" ;; 62 | } 63 | 64 | dimension: address { 65 | type: string 66 | sql: ${TABLE}."ADDRESS" ;; 67 | } 68 | 69 | dimension: city { 70 | type: string 71 | sql: ${TABLE}."CITY" ;; 72 | } 73 | 74 | dimension: code { 75 | type: string 76 | sql: ${TABLE}."CODE" ;; 77 | } 78 | 79 | dimension: comment { 80 | type: string 81 | sql: ${TABLE}."COMMENT" ;; 82 | } 83 | 84 | # improperly labeled in db as country 85 | dimension: state { 86 | type: string 87 | map_layer_name: us_states 88 | sql: ${TABLE}."COUNTRY" ;; 89 | } 90 | 91 | dimension: enabled { 92 | type: yesno 93 | sql: ${TABLE}."ENABLED" ;; 94 | } 95 | 96 | dimension: external_id { 97 | type: string 98 | sql: ${TABLE}."EXTERNAL_ID" ;; 99 | } 100 | 101 | dimension: had_menu { 102 | type: yesno 103 | sql: ${TABLE}."HAD_MENU" ;; 104 | } 105 | 106 | dimension: location_area_id { 107 | type: number 108 | sql: ${TABLE}."LOCATION_AREA_ID" ;; 109 | } 110 | 111 | dimension: menupages_urls { 112 | type: string 113 | sql: ${TABLE}."MENUPAGES_URLS" ;; 114 | } 115 | 116 | dimension: name { 117 | type: string 118 | sql: ${TABLE}."NAME" ;; 119 | } 120 | 121 | dimension: neighborhood { 122 | type: string 123 | sql: ${TABLE}."NEIGHBORHOOD" ;; 124 | } 125 | 126 | dimension: ordered_menu { 127 | type: yesno 128 | sql: ${TABLE}."ORDERED_MENU" ;; 129 | } 130 | 131 | dimension: phone_number { 132 | type: string 133 | sql: ${TABLE}."PHONE_NUMBER" ;; 134 | } 135 | 136 | dimension: popularity { 137 | type: number 138 | sql: ${TABLE}."POPULARITY" ;; 139 | } 140 | 141 | dimension: postcode { 142 | type: string 143 | map_layer_name: us_zipcode_tabulation_areas 144 | sql: ${TABLE}."POSTCODE" ;; 145 | } 146 | 147 | dimension: price_rating { 148 | type: number 149 | sql: ${TABLE}."PRICE_RATING" ;; 150 | } 151 | 152 | dimension: reviewed { 153 | type: yesno 154 | sql: ${TABLE}."REVIEWED" ;; 155 | } 156 | 157 | dimension: reviewed_by_id { 158 | type: number 159 | sql: ${TABLE}."REVIEWED_BY_ID" ;; 160 | } 161 | 162 | dimension: source { 163 | type: string 164 | sql: ${TABLE}."SOURCE" ;; 165 | } 166 | 167 | dimension_group: timestamp_added { 168 | type: time 169 | timeframes: [ 170 | raw, 171 | time, 172 | date, 173 | week, 174 | month, 175 | quarter, 176 | year 177 | ] 178 | sql: ${TABLE}."TIMESTAMP_ADDED" ;; 179 | } 180 | 181 | dimension_group: timestamp_reprocessed { 182 | type: time 183 | timeframes: [ 184 | raw, 185 | time, 186 | date, 187 | week, 188 | month, 189 | quarter, 190 | year 191 | ] 192 | sql: ${TABLE}."TIMESTAMP_REPROCESSED" ;; 193 | } 194 | 195 | dimension_group: timestamp_updated { 196 | type: time 197 | timeframes: [ 198 | raw, 199 | time, 200 | date, 201 | week, 202 | month, 203 | quarter, 204 | year 205 | ] 206 | sql: ${TABLE}."TIMESTAMP_UPDATED" ;; 207 | } 208 | 209 | dimension: type { 210 | type: number 211 | sql: ${TABLE}."TYPE" ;; 212 | } 213 | 214 | dimension: website { 215 | type: string 216 | sql: ${TABLE}."WEBSITE" ;; 217 | } 218 | 219 | measure: count { 220 | type: count 221 | drill_fields: [id, name] 222 | } 223 | } 224 | -------------------------------------------------------------------------------- /tipsi/views/api_winetbl.view.lkml: -------------------------------------------------------------------------------- 1 | view: api_winetbl { 2 | sql_table_name: TIPSI.PUBLIC.API_WINETBL ;; 3 | drill_fields: [id] 4 | 5 | dimension: id { 6 | primary_key: yes 7 | type: number 8 | sql: ${TABLE}."ID" ;; 9 | } 10 | 11 | # Wine and Drink Combined { 12 | 13 | dimension: name_combined { 14 | type: string 15 | sql: COALESCE(${api_winetbl.name},${vendor_drink.name}) ;; 16 | } 17 | #} 18 | 19 | dimension: appellation_id { 20 | type: number 21 | sql: ${TABLE}."APPELLATION_ID" ;; 22 | } 23 | 24 | dimension: color { 25 | type: number 26 | sql: ${TABLE}."COLOR" ;; 27 | } 28 | 29 | dimension: country_id { 30 | type: number 31 | sql: ${TABLE}."COUNTRY_ID" ;; 32 | } 33 | 34 | dimension_group: created { 35 | type: time 36 | timeframes: [ 37 | raw, 38 | time, 39 | date, 40 | week, 41 | month, 42 | quarter, 43 | year 44 | ] 45 | sql: ${TABLE}."CREATED" ;; 46 | } 47 | 48 | dimension: custom_name { 49 | type: string 50 | sql: ${TABLE}."CUSTOM_NAME" ;; 51 | } 52 | 53 | dimension: designation_id { 54 | type: number 55 | sql: ${TABLE}."DESIGNATION_ID" ;; 56 | } 57 | 58 | dimension: display_label_url { 59 | type: string 60 | sql: ${TABLE}."DISPLAY_LABEL_URL" ;; 61 | } 62 | 63 | dimension: extra_appellation_id { 64 | type: number 65 | sql: ${TABLE}."EXTRA_APPELLATION_ID" ;; 66 | } 67 | 68 | dimension: is_junk { 69 | type: yesno 70 | sql: ${TABLE}."IS_JUNK" ;; 71 | } 72 | 73 | dimension: is_provider_wine { 74 | type: yesno 75 | sql: ${TABLE}."IS_PROVIDER_WINE" ;; 76 | } 77 | 78 | dimension: is_standard_size { 79 | type: yesno 80 | sql: ${TABLE}."IS_STANDARD_SIZE" ;; 81 | } 82 | 83 | dimension: label_url { 84 | type: string 85 | sql: ${TABLE}."LABEL_URL" ;; 86 | } 87 | 88 | dimension: name { 89 | type: string 90 | sql: ${TABLE}."NAME" ;; 91 | } 92 | 93 | dimension: price_retail { 94 | type: number 95 | sql: ${TABLE}."PRICE_RETAIL" ;; 96 | } 97 | 98 | dimension: provider_info_id { 99 | type: number 100 | sql: ${TABLE}."PROVIDER_INFO_ID" ;; 101 | } 102 | 103 | dimension: region_id { 104 | type: number 105 | sql: ${TABLE}."REGION_ID" ;; 106 | } 107 | 108 | dimension: sub_appellation_id { 109 | type: number 110 | sql: ${TABLE}."SUB_APPELLATION_ID" ;; 111 | } 112 | 113 | dimension: sub_region_id { 114 | type: number 115 | sql: ${TABLE}."SUB_REGION_ID" ;; 116 | } 117 | 118 | dimension: thumb_list_url { 119 | type: string 120 | sql: ${TABLE}."THUMB_LIST_URL" ;; 121 | } 122 | 123 | dimension: thumb_product_url { 124 | type: string 125 | sql: ${TABLE}."THUMB_PRODUCT_URL" ;; 126 | } 127 | 128 | dimension_group: tineye_upload { 129 | type: time 130 | timeframes: [ 131 | raw, 132 | time, 133 | date, 134 | week, 135 | month, 136 | quarter, 137 | year 138 | ] 139 | sql: ${TABLE}."TINEYE_UPLOAD_DATE" ;; 140 | } 141 | 142 | dimension: type { 143 | type: number 144 | sql: ${TABLE}."TYPE" ;; 145 | } 146 | 147 | dimension_group: updated { 148 | type: time 149 | timeframes: [ 150 | raw, 151 | time, 152 | date, 153 | week, 154 | month, 155 | quarter, 156 | year 157 | ] 158 | sql: ${TABLE}."UPDATED" ;; 159 | } 160 | 161 | dimension: validated { 162 | type: yesno 163 | sql: ${TABLE}."VALIDATED" ;; 164 | } 165 | 166 | dimension: varietal2_id { 167 | type: number 168 | sql: ${TABLE}."VARIETAL2_ID" ;; 169 | } 170 | 171 | dimension: varietal3_id { 172 | type: number 173 | sql: ${TABLE}."VARIETAL3_ID" ;; 174 | } 175 | 176 | dimension: varietal4_id { 177 | type: number 178 | sql: ${TABLE}."VARIETAL4_ID" ;; 179 | } 180 | 181 | dimension: varietal_id { 182 | type: number 183 | sql: ${TABLE}."VARIETAL_ID" ;; 184 | } 185 | 186 | dimension: vinatage { 187 | type: number 188 | sql: ${TABLE}."VINATAGE" ;; 189 | } 190 | 191 | dimension: vineyard_id { 192 | type: number 193 | sql: ${TABLE}."VINEYARD_ID" ;; 194 | } 195 | 196 | dimension: wine_url { 197 | type: string 198 | sql: ${TABLE}."WINE_URL" ;; 199 | } 200 | 201 | dimension: winemakers_note { 202 | type: string 203 | sql: ${TABLE}."WINEMAKERS_NOTE" ;; 204 | } 205 | 206 | dimension: winemakers_note_source_url { 207 | type: string 208 | sql: ${TABLE}."WINEMAKERS_NOTE_SOURCE_URL" ;; 209 | } 210 | 211 | dimension: winery_id { 212 | type: number 213 | sql: ${TABLE}."WINERY_ID" ;; 214 | } 215 | 216 | measure: count { 217 | type: count 218 | drill_fields: [id, name, custom_name] 219 | } 220 | } -------------------------------------------------------------------------------- /drync/line_items.view.lkml: -------------------------------------------------------------------------------- 1 | view: line_items { 2 | sql_table_name: PRODUCTION.LINE_ITEMS ;; 3 | drill_fields: [id] 4 | 5 | dimension: id { 6 | primary_key: yes 7 | type: number 8 | sql: ${TABLE}."ID" ;; 9 | } 10 | 11 | dimension_group: _sdc_batched { 12 | type: time 13 | timeframes: [ 14 | raw, 15 | time, 16 | date, 17 | week, 18 | month, 19 | quarter, 20 | year 21 | ] 22 | sql: ${TABLE}."_SDC_BATCHED_AT" ;; 23 | } 24 | 25 | dimension_group: _sdc_extracted { 26 | type: time 27 | timeframes: [ 28 | raw, 29 | time, 30 | date, 31 | week, 32 | month, 33 | quarter, 34 | year 35 | ] 36 | sql: ${TABLE}."_SDC_EXTRACTED_AT" ;; 37 | } 38 | 39 | dimension_group: _sdc_received { 40 | type: time 41 | timeframes: [ 42 | raw, 43 | time, 44 | date, 45 | week, 46 | month, 47 | quarter, 48 | year 49 | ] 50 | sql: ${TABLE}."_SDC_RECEIVED_AT" ;; 51 | } 52 | 53 | dimension: _sdc_sequence { 54 | type: number 55 | sql: ${TABLE}."_SDC_SEQUENCE" ;; 56 | } 57 | 58 | dimension: _sdc_table_version { 59 | type: number 60 | sql: ${TABLE}."_SDC_TABLE_VERSION" ;; 61 | } 62 | 63 | dimension: amended_price_per_bottle { 64 | type: number 65 | sql: ${TABLE}."AMENDED_PRICE_PER_BOTTLE" ;; 66 | } 67 | 68 | dimension: bottle_id { 69 | type: number 70 | sql: ${TABLE}."BOTTLE_ID" ;; 71 | } 72 | 73 | dimension: bridge_bottle_id { 74 | description: "The bottle ID cast as a string" 75 | type: string 76 | sql: ${bottle_id}::string ;; 77 | } 78 | 79 | dimension: bottle_name { 80 | type: string 81 | sql: ${TABLE}."BOTTLE_NAME" ;; 82 | } 83 | 84 | dimension: bottle_packaging { 85 | type: string 86 | sql: ${TABLE}."BOTTLE_PACKAGING" ;; 87 | } 88 | 89 | dimension: cork_id { 90 | type: number 91 | sql: ${TABLE}."CORK_ID" ;; 92 | } 93 | 94 | dimension_group: created { 95 | type: time 96 | timeframes: [ 97 | raw, 98 | time, 99 | date, 100 | week, 101 | month, 102 | quarter, 103 | year 104 | ] 105 | sql: ${TABLE}."CREATED_AT" ;; 106 | } 107 | 108 | dimension: current_vintage { 109 | type: yesno 110 | sql: ${TABLE}."CURRENT_VINTAGE" ;; 111 | } 112 | 113 | dimension_group: deleted { 114 | type: time 115 | timeframes: [ 116 | raw, 117 | time, 118 | date, 119 | week, 120 | month, 121 | quarter, 122 | year 123 | ] 124 | sql: ${TABLE}."DELETED_AT" ;; 125 | } 126 | 127 | dimension: deposit { 128 | type: number 129 | sql: ${TABLE}."DEPOSIT" ;; 130 | } 131 | 132 | dimension: discount_per_bottle { 133 | type: number 134 | sql: ${TABLE}."DISCOUNT_PER_BOTTLE"/100 ;; 135 | value_format_name: usd 136 | } 137 | 138 | dimension: discount_rule_id { 139 | type: number 140 | sql: ${TABLE}."DISCOUNT_RULE_ID" ;; 141 | } 142 | 143 | dimension: exception_cause { 144 | type: string 145 | sql: ${TABLE}."EXCEPTION_CAUSE" ;; 146 | } 147 | 148 | dimension: fulfiller_price_per_bottle { 149 | type: number 150 | sql: ${TABLE}."FULFILLER_PRICE_PER_BOTTLE" ;; 151 | } 152 | 153 | dimension: markup_percentage { 154 | type: number 155 | sql: ${TABLE}."MARKUP_PERCENTAGE" ;; 156 | } 157 | 158 | dimension: message { 159 | type: string 160 | sql: ${TABLE}."MESSAGE" ;; 161 | } 162 | 163 | dimension: previous_price { 164 | type: number 165 | sql: ${TABLE}."PREVIOUS_PRICE" ;; 166 | } 167 | 168 | dimension: price_per_bottle { 169 | type: number 170 | sql: ${TABLE}."PRICE_PER_BOTTLE"/100 ;; 171 | value_format_name: usd 172 | } 173 | 174 | dimension: quantity { 175 | type: number 176 | sql: ${TABLE}."QUANTITY" ;; 177 | } 178 | 179 | dimension: referer { 180 | type: string 181 | sql: ${TABLE}."REFERER" ;; 182 | } 183 | 184 | dimension: retailer_bottle_source_id { 185 | type: number 186 | sql: ${TABLE}.retailer_bottle_source_id ;; 187 | } 188 | 189 | dimension: shipment_id { 190 | type: number 191 | # hidden: yes 192 | sql: ${TABLE}."SHIPMENT_ID" ;; 193 | } 194 | 195 | dimension: status { 196 | type: string 197 | sql: ${TABLE}."STATUS" ;; 198 | } 199 | 200 | dimension_group: update_expected_by { 201 | type: time 202 | timeframes: [ 203 | raw, 204 | time, 205 | date, 206 | week, 207 | month, 208 | quarter, 209 | year 210 | ] 211 | sql: ${TABLE}."UPDATE_EXPECTED_BY" ;; 212 | } 213 | 214 | dimension_group: updated { 215 | type: time 216 | timeframes: [ 217 | raw, 218 | time, 219 | date, 220 | week, 221 | month, 222 | quarter, 223 | year 224 | ] 225 | sql: ${TABLE}."UPDATED_AT" ;; 226 | } 227 | 228 | measure: count { 229 | type: count 230 | drill_fields: [id, bottle_name, shipments.name, shipments.id] 231 | } 232 | } 233 | -------------------------------------------------------------------------------- /drync/shipments.view.lkml: -------------------------------------------------------------------------------- 1 | view: shipments { 2 | sql_table_name: PRODUCTION.PRODUCTION.SHIPMENTS ;; 3 | drill_fields: [id] 4 | 5 | dimension: id { 6 | primary_key: yes 7 | type: number 8 | sql: ${TABLE}."ID" ;; 9 | } 10 | 11 | dimension_group: _sdc_batched { 12 | type: time 13 | timeframes: [ 14 | raw, 15 | time, 16 | date, 17 | week, 18 | month, 19 | quarter, 20 | year 21 | ] 22 | sql: ${TABLE}."_SDC_BATCHED_AT" ;; 23 | } 24 | 25 | dimension_group: _sdc_extracted { 26 | type: time 27 | timeframes: [ 28 | raw, 29 | time, 30 | date, 31 | week, 32 | month, 33 | quarter, 34 | year 35 | ] 36 | sql: ${TABLE}."_SDC_EXTRACTED_AT" ;; 37 | } 38 | 39 | dimension_group: _sdc_received { 40 | type: time 41 | timeframes: [ 42 | raw, 43 | time, 44 | date, 45 | week, 46 | month, 47 | quarter, 48 | year 49 | ] 50 | sql: ${TABLE}."_SDC_RECEIVED_AT" ;; 51 | } 52 | 53 | dimension: _sdc_sequence { 54 | type: number 55 | sql: ${TABLE}."_SDC_SEQUENCE" ;; 56 | } 57 | 58 | dimension: _sdc_table_version { 59 | type: number 60 | sql: ${TABLE}."_SDC_TABLE_VERSION" ;; 61 | } 62 | 63 | dimension_group: accepted { 64 | type: time 65 | timeframes: [ 66 | raw, 67 | time, 68 | date, 69 | week, 70 | month, 71 | quarter, 72 | year 73 | ] 74 | sql: ${TABLE}."ACCEPTED_AT" ;; 75 | } 76 | 77 | dimension: city { 78 | type: string 79 | sql: ${TABLE}."CITY" ;; 80 | } 81 | 82 | dimension_group: created { 83 | type: time 84 | timeframes: [ 85 | raw, 86 | time, 87 | date, 88 | week, 89 | month, 90 | quarter, 91 | year 92 | ] 93 | sql: ${TABLE}."CREATED_AT" ;; 94 | } 95 | 96 | dimension: credit_card_fee { 97 | type: number 98 | sql: ${TABLE}."CREDIT_CARD_FEE" ;; 99 | } 100 | 101 | dimension: discount { 102 | type: number 103 | sql: ${TABLE}."DISCOUNT" ;; 104 | } 105 | 106 | dimension: email { 107 | type: string 108 | sql: ${TABLE}."EMAIL" ;; 109 | } 110 | 111 | dimension: fulfiller_discount { 112 | type: number 113 | sql: ${TABLE}."FULFILLER_DISCOUNT" ;; 114 | } 115 | 116 | dimension: fulfiller_id { 117 | type: number 118 | sql: ${TABLE}."FULFILLER_ID" ;; 119 | } 120 | 121 | dimension: fulfillment_method { 122 | type: string 123 | sql: ${TABLE}."FULFILLMENT_METHOD" ;; 124 | } 125 | 126 | dimension: marketing_fee { 127 | type: number 128 | sql: ${TABLE}."MARKETING_FEE" ;; 129 | } 130 | 131 | dimension: marketing_fee_percent { 132 | type: number 133 | sql: ${TABLE}."MARKETING_FEE_PERCENT" ;; 134 | } 135 | 136 | dimension: name { 137 | type: string 138 | sql: ${TABLE}."NAME" ;; 139 | } 140 | 141 | dimension: order_id { 142 | type: number 143 | sql: ${TABLE}."ORDER_ID" ;; 144 | } 145 | 146 | dimension: payable_invoice_id { 147 | type: number 148 | sql: ${TABLE}."PAYABLE_INVOICE_ID" ;; 149 | } 150 | 151 | dimension: phone_number { 152 | type: string 153 | sql: ${TABLE}."PHONE_NUMBER" ;; 154 | } 155 | 156 | dimension: receivable_invoice_id { 157 | type: number 158 | sql: ${TABLE}."RECEIVABLE_INVOICE_ID" ;; 159 | } 160 | 161 | dimension_group: shipped { 162 | type: time 163 | timeframes: [ 164 | raw, 165 | time, 166 | date, 167 | week, 168 | month, 169 | quarter, 170 | year 171 | ] 172 | sql: ${TABLE}."SHIPPED_AT" ;; 173 | } 174 | 175 | dimension: shipping_cost { 176 | type: number 177 | sql: ${TABLE}."SHIPPING_COST" ;; 178 | } 179 | 180 | dimension: state { 181 | type: string 182 | sql: ${TABLE}."STATE" ;; 183 | } 184 | 185 | dimension: status { 186 | type: string 187 | sql: ${TABLE}."STATUS" ;; 188 | } 189 | 190 | dimension: street1 { 191 | type: string 192 | sql: ${TABLE}."STREET1" ;; 193 | } 194 | 195 | dimension: street2 { 196 | type: string 197 | sql: ${TABLE}."STREET2" ;; 198 | } 199 | 200 | dimension: tax { 201 | type: number 202 | sql: ${TABLE}."TAX" ;; 203 | } 204 | 205 | dimension: tracking_number { 206 | type: string 207 | sql: ${TABLE}."TRACKING_NUMBER" ;; 208 | } 209 | 210 | dimension_group: update_expected_by { 211 | type: time 212 | timeframes: [ 213 | raw, 214 | time, 215 | date, 216 | week, 217 | month, 218 | quarter, 219 | year 220 | ] 221 | sql: ${TABLE}."UPDATE_EXPECTED_BY" ;; 222 | } 223 | 224 | dimension_group: updated { 225 | type: time 226 | timeframes: [ 227 | raw, 228 | time, 229 | date, 230 | week, 231 | month, 232 | quarter, 233 | year 234 | ] 235 | sql: ${TABLE}."UPDATED_AT" ;; 236 | } 237 | 238 | dimension: zip { 239 | type: zipcode 240 | sql: ${TABLE}."ZIP" ;; 241 | } 242 | 243 | measure: count { 244 | type: count 245 | drill_fields: [id, name, line_items.count] 246 | } 247 | } 248 | -------------------------------------------------------------------------------- /drync/payments.view.lkml: -------------------------------------------------------------------------------- 1 | view: payments { 2 | sql_table_name: "PRODUCTION"."PAYMENTS" 3 | ;; 4 | drill_fields: [id] 5 | 6 | dimension: id { 7 | primary_key: yes 8 | type: number 9 | sql: ${TABLE}."ID" ;; 10 | } 11 | 12 | dimension_group: _sdc_batched { 13 | type: time 14 | timeframes: [ 15 | raw, 16 | time, 17 | date, 18 | week, 19 | month, 20 | quarter, 21 | year 22 | ] 23 | sql: ${TABLE}."_SDC_BATCHED_AT" ;; 24 | } 25 | 26 | dimension_group: _sdc_extracted { 27 | type: time 28 | timeframes: [ 29 | raw, 30 | time, 31 | date, 32 | week, 33 | month, 34 | quarter, 35 | year 36 | ] 37 | sql: ${TABLE}."_SDC_EXTRACTED_AT" ;; 38 | } 39 | 40 | dimension_group: _sdc_received { 41 | type: time 42 | timeframes: [ 43 | raw, 44 | time, 45 | date, 46 | week, 47 | month, 48 | quarter, 49 | year 50 | ] 51 | sql: ${TABLE}."_SDC_RECEIVED_AT" ;; 52 | } 53 | 54 | dimension: _sdc_sequence { 55 | type: number 56 | sql: ${TABLE}."_SDC_SEQUENCE" ;; 57 | } 58 | 59 | dimension: _sdc_table_version { 60 | type: number 61 | sql: ${TABLE}."_SDC_TABLE_VERSION" ;; 62 | } 63 | 64 | dimension: braintree_device_data { 65 | type: string 66 | sql: ${TABLE}."BRAINTREE_DEVICE_DATA" ;; 67 | } 68 | 69 | dimension: braintree_gateway_rejection_reason { 70 | type: string 71 | sql: ${TABLE}."BRAINTREE_GATEWAY_REJECTION_REASON" ;; 72 | } 73 | 74 | dimension: braintree_nonce { 75 | type: string 76 | sql: ${TABLE}."BRAINTREE_NONCE" ;; 77 | } 78 | 79 | dimension: braintree_payment_token { 80 | type: string 81 | sql: ${TABLE}."BRAINTREE_PAYMENT_TOKEN" ;; 82 | } 83 | 84 | dimension: braintree_processor_response_text { 85 | type: string 86 | sql: ${TABLE}."BRAINTREE_PROCESSOR_RESPONSE_TEXT" ;; 87 | } 88 | 89 | dimension: card_type { 90 | type: string 91 | sql: ${TABLE}."CARD_TYPE" ;; 92 | } 93 | 94 | dimension: card_uuid { 95 | type: string 96 | sql: ${TABLE}."CARD_UUID" ;; 97 | } 98 | 99 | dimension_group: created { 100 | type: time 101 | timeframes: [ 102 | raw, 103 | time, 104 | date, 105 | week, 106 | month, 107 | quarter, 108 | year 109 | ] 110 | sql: ${TABLE}."CREATED_AT" ;; 111 | } 112 | 113 | dimension: credit_card_cvv { 114 | type: string 115 | sql: ${TABLE}."CREDIT_CARD_CVV" ;; 116 | } 117 | 118 | dimension: credit_card_expiration_month { 119 | type: string 120 | sql: ${TABLE}."CREDIT_CARD_EXPIRATION_MONTH" ;; 121 | } 122 | 123 | dimension: credit_card_expiration_year { 124 | type: string 125 | sql: ${TABLE}."CREDIT_CARD_EXPIRATION_YEAR" ;; 126 | } 127 | 128 | dimension: credit_card_number { 129 | type: string 130 | sql: ${TABLE}."CREDIT_CARD_NUMBER" ;; 131 | } 132 | 133 | dimension: credit_card_source { 134 | type: string 135 | sql: ${TABLE}."CREDIT_CARD_SOURCE" ;; 136 | } 137 | 138 | dimension: error_messages { 139 | type: string 140 | sql: ${TABLE}."ERROR_MESSAGES" ;; 141 | } 142 | 143 | dimension: last_4_digit { 144 | type: string 145 | sql: ${TABLE}."LAST_4_DIGIT" ;; 146 | } 147 | 148 | dimension: order_id { 149 | type: number 150 | sql: ${TABLE}."ORDER_ID" ;; 151 | } 152 | 153 | dimension: payment_gateway_id { 154 | type: number 155 | sql: ${TABLE}."PAYMENT_GATEWAY_ID" ;; 156 | } 157 | 158 | dimension: save_card { 159 | type: yesno 160 | sql: ${TABLE}."SAVE_CARD" ;; 161 | } 162 | 163 | dimension_group: status_changed { 164 | type: time 165 | timeframes: [ 166 | raw, 167 | time, 168 | date, 169 | week, 170 | month, 171 | quarter, 172 | year 173 | ] 174 | sql: ${TABLE}."STATUS_CHANGED_AT" ;; 175 | } 176 | 177 | dimension_group: submitted_for_settlement { 178 | type: time 179 | timeframes: [ 180 | raw, 181 | time, 182 | date, 183 | week, 184 | month, 185 | quarter, 186 | year 187 | ] 188 | sql: ${TABLE}."SUBMITTED_FOR_SETTLEMENT_AT" ;; 189 | } 190 | 191 | dimension: total_amount { 192 | type: number 193 | sql: ${TABLE}."TOTAL_AMOUNT" ;; 194 | } 195 | 196 | dimension: transaction_id { 197 | type: string 198 | sql: ${TABLE}."TRANSACTION_ID" ;; 199 | } 200 | 201 | dimension: transaction_status { 202 | type: string 203 | sql: ${TABLE}."TRANSACTION_STATUS" ;; 204 | } 205 | 206 | dimension: type { 207 | type: string 208 | sql: ${TABLE}."TYPE" ;; 209 | } 210 | 211 | dimension_group: updated { 212 | type: time 213 | timeframes: [ 214 | raw, 215 | time, 216 | date, 217 | week, 218 | month, 219 | quarter, 220 | year 221 | ] 222 | sql: ${TABLE}."UPDATED_AT" ;; 223 | } 224 | 225 | dimension: using_merchant_gateway { 226 | type: yesno 227 | sql: ${TABLE}."USING_MERCHANT_GATEWAY" ;; 228 | } 229 | 230 | measure: count { 231 | type: count 232 | drill_fields: [id] 233 | } 234 | } 235 | -------------------------------------------------------------------------------- /tipsi/tipsi.explore.view.lkml: -------------------------------------------------------------------------------- 1 | include: "./views/*.view.lkml" 2 | include: "./derived_views/*.view.lkml" 3 | 4 | explore: products { 5 | from: retail_retailinventory 6 | group_label: "Tipsi" 7 | join: api_winetbl { 8 | type: left_outer 9 | sql_on: ${products.wine_id} = ${api_winetbl.id} ;; 10 | relationship: many_to_one 11 | } 12 | join: vendor_drink { 13 | type: left_outer 14 | sql_on: ${products.drink_id} = ${vendor_drink.id} ;; 15 | relationship: many_to_one 16 | } 17 | join: vendor_drinkproducer { 18 | type: left_outer 19 | sql_on: ${vendor_drink.producer_id} = ${vendor_drinkproducer.id} ;; 20 | relationship: many_to_one 21 | } 22 | join: vendor_drinktag { 23 | type: left_outer 24 | sql_on: ${vendor_drink.tag_id} = ${vendor_drinktag.id} ;; 25 | relationship: many_to_one 26 | } 27 | join: vendor_drinkinventory { 28 | type: left_outer 29 | sql_on: ${vendor_drink.id} = ${vendor_drinkinventory.drink_id} ;; 30 | relationship: one_to_many 31 | } 32 | } 33 | 34 | explore: users_tipsi { 35 | from: tipsi_auth_user 36 | group_label: "Tipsi" 37 | join: notifications_fcmdevice { 38 | view_label: "Devices" 39 | type: inner 40 | sql_on: ${users_tipsi.id} = ${notifications_fcmdevice.user_id} ;; 41 | relationship: many_to_one 42 | } 43 | join: order_order { 44 | view_label: "Orders" 45 | type: left_outer 46 | sql_on: ${users_tipsi.id} = ${order_order.user_id} ;; 47 | relationship: one_to_many 48 | } 49 | join: order_orderproduct { 50 | view_label: "Order Product" 51 | type: left_outer 52 | sql_on: ${order_order.id} = ${order_orderproduct.order_id} ;; 53 | relationship: many_to_one 54 | } 55 | join: vendor_drink { 56 | view_label: "Drinks" 57 | type: left_outer 58 | sql_on: ${order_orderproduct.drink_id} = ${vendor_drink.id} ;; 59 | relationship: many_to_one 60 | } 61 | join: vendor_drinkproducer { 62 | view_label: "Drink Producer" 63 | type: left_outer 64 | sql_on: ${vendor_drink.producer_id} = ${vendor_drinkproducer.id} ;; 65 | relationship: many_to_one 66 | } 67 | join: vendor_drinktag { 68 | view_label: "Drink Tag" 69 | type: left_outer 70 | sql_on: ${vendor_drink.tag_id} = ${vendor_drinktag.id} ;; 71 | relationship: many_to_one 72 | } 73 | join: vendor_drinkinventory { 74 | view_label: "Drink Inventory" 75 | type: left_outer 76 | sql_on: ${vendor_drink.id} = ${vendor_drinkinventory.drink_id} ;; 77 | relationship: one_to_many 78 | } 79 | join: api_winetbl { 80 | view_label: "Wines" 81 | type: left_outer 82 | sql_on: ${order_orderproduct.wine_id} = ${api_winetbl.id} ;; 83 | relationship: many_to_one 84 | } 85 | } 86 | 87 | explore: orders_tipsi { 88 | from: order_order 89 | group_label: "Tipsi" 90 | #view_name: order_order 91 | join: retail_store { 92 | type: inner 93 | sql_on: ${orders_tipsi.store_id} = ${retail_store.restaurant_id} ;; 94 | relationship: many_to_one 95 | } 96 | join: core_restaurant { 97 | type: inner 98 | sql_on: ${retail_store.restaurant_id} = ${core_restaurant.id} ;; 99 | relationship: many_to_one 100 | } 101 | join: retail_retailstoregroupthrough { 102 | type: inner 103 | sql_on: ${core_restaurant.id} = ${retail_retailstoregroupthrough.store_id} ;; 104 | relationship: many_to_one 105 | } 106 | join: retail_retailgroup { 107 | type: inner 108 | sql_on: ${retail_retailstoregroupthrough.group_id} = ${retail_retailgroup.id} ;; 109 | relationship: many_to_one 110 | } 111 | join: users { 112 | from: tipsi_auth_user 113 | type: inner 114 | sql_on: ${users.id} = ${orders_tipsi.user_id} ;; 115 | relationship: many_to_one 116 | } 117 | join: notifications_fcmdevice { 118 | view_label: "Devices" 119 | type: inner 120 | sql_on: ${users.id} = ${notifications_fcmdevice.user_id} ;; 121 | relationship: many_to_one 122 | } 123 | join: order_orderproduct { 124 | view_label: "Order Product" 125 | type: left_outer 126 | sql_on: ${orders_tipsi.id} = ${order_orderproduct.order_id} ;; 127 | relationship: many_to_one 128 | } 129 | join: vendor_drink { 130 | view_label: "Drinks" 131 | type: left_outer 132 | sql_on: ${order_orderproduct.drink_id} = ${vendor_drink.id} ;; 133 | relationship: many_to_one 134 | } 135 | join: vendor_drinkproducer { 136 | view_label: "Drink Producer" 137 | type: left_outer 138 | sql_on: ${vendor_drink.producer_id} = ${vendor_drinkproducer.id} ;; 139 | relationship: many_to_one 140 | } 141 | join: vendor_drinktag { 142 | view_label: "Drink Tag" 143 | type: left_outer 144 | sql_on: ${vendor_drink.tag_id} = ${vendor_drinktag.id} ;; 145 | relationship: many_to_one 146 | } 147 | join: vendor_drinkinventory { 148 | view_label: "Drink Inventory" 149 | type: left_outer 150 | sql_on: ${vendor_drink.id} = ${vendor_drinkinventory.drink_id} ;; 151 | relationship: one_to_many 152 | } 153 | join: api_winetbl { 154 | view_label: "Wines" 155 | type: left_outer 156 | sql_on: ${order_orderproduct.wine_id} = ${api_winetbl.id} ;; 157 | relationship: many_to_one 158 | } 159 | } 160 | 161 | explore: products_tipsi { 162 | group_label: "Tipsi" 163 | } 164 | 165 | explore: retail_retailgroup { 166 | group_label: "Tipsi" 167 | } 168 | 169 | explore: order_products_tipsi { 170 | from: order_orderproduct 171 | group_label: "Tipsi" 172 | } 173 | 174 | explore: devices_tipsi { 175 | from: notifications_fcmdevice 176 | group_label: "Tipsi" 177 | } 178 | -------------------------------------------------------------------------------- /drync/retailer_bottle_sources.view.lkml: -------------------------------------------------------------------------------- 1 | view: retailer_bottle_sources { 2 | sql_table_name: PRODUCTION.RETAILER_BOTTLE_SOURCES ;; 3 | drill_fields: [id] 4 | 5 | dimension: id { 6 | primary_key: yes 7 | type: number 8 | sql: ${TABLE}."ID" ;; 9 | } 10 | 11 | dimension_group: _sdc_batched { 12 | type: time 13 | timeframes: [ 14 | raw, 15 | time, 16 | date, 17 | week, 18 | month, 19 | quarter, 20 | year 21 | ] 22 | sql: ${TABLE}."_SDC_BATCHED_AT" ;; 23 | } 24 | 25 | dimension_group: _sdc_extracted { 26 | type: time 27 | timeframes: [ 28 | raw, 29 | time, 30 | date, 31 | week, 32 | month, 33 | quarter, 34 | year 35 | ] 36 | sql: ${TABLE}."_SDC_EXTRACTED_AT" ;; 37 | } 38 | 39 | dimension_group: _sdc_received { 40 | type: time 41 | timeframes: [ 42 | raw, 43 | time, 44 | date, 45 | week, 46 | month, 47 | quarter, 48 | year 49 | ] 50 | sql: ${TABLE}."_SDC_RECEIVED_AT" ;; 51 | } 52 | 53 | dimension: _sdc_sequence { 54 | type: number 55 | sql: ${TABLE}."_SDC_SEQUENCE" ;; 56 | } 57 | 58 | dimension: _sdc_table_version { 59 | type: number 60 | sql: ${TABLE}."_SDC_TABLE_VERSION" ;; 61 | } 62 | 63 | dimension: allows_delivery { 64 | type: yesno 65 | sql: ${TABLE}."ALLOWS_DELIVERY" ;; 66 | } 67 | 68 | dimension: allows_pickup { 69 | type: yesno 70 | sql: ${TABLE}."ALLOWS_PICKUP" ;; 71 | } 72 | 73 | dimension: allows_shipping { 74 | type: yesno 75 | sql: ${TABLE}."ALLOWS_SHIPPING" ;; 76 | } 77 | 78 | dimension: average_retail_price { 79 | type: number 80 | sql: ${TABLE}."AVERAGE_RETAIL_PRICE" ;; 81 | } 82 | 83 | dimension: bottle_source_id { 84 | type: number 85 | sql: ${TABLE}."BOTTLE_SOURCE_ID" ;; 86 | } 87 | 88 | dimension_group: created { 89 | type: time 90 | timeframes: [ 91 | raw, 92 | time, 93 | date, 94 | week, 95 | month, 96 | quarter, 97 | year 98 | ] 99 | sql: ${TABLE}."CREATED_AT" ;; 100 | } 101 | 102 | dimension: deposit { 103 | type: number 104 | sql: ${TABLE}."DEPOSIT" ;; 105 | } 106 | 107 | dimension: discount_codes { 108 | type: string 109 | sql: ${TABLE}."DISCOUNT_CODES" ;; 110 | } 111 | 112 | dimension: drync_retail_price { 113 | type: number 114 | sql: ${TABLE}."DRYNC_RETAIL_PRICE" ;; 115 | } 116 | 117 | dimension: ebay_deal { 118 | type: yesno 119 | sql: ${TABLE}."EBAY_DEAL" ;; 120 | } 121 | 122 | dimension: front_line_price { 123 | type: number 124 | sql: ${TABLE}."FRONT_LINE_PRICE" ;; 125 | } 126 | 127 | dimension: identifiers { 128 | type: string 129 | sql: ${TABLE}."IDENTIFIERS" ;; 130 | } 131 | 132 | dimension_group: imported { 133 | type: time 134 | timeframes: [ 135 | raw, 136 | time, 137 | date, 138 | week, 139 | month, 140 | quarter, 141 | year 142 | ] 143 | sql: ${TABLE}."IMPORTED_AT" ;; 144 | } 145 | 146 | dimension: in_stock { 147 | type: number 148 | sql: ${TABLE}."IN_STOCK" ;; 149 | } 150 | 151 | dimension: per_customer_limit { 152 | type: number 153 | sql: ${TABLE}."PER_CUSTOMER_LIMIT" ;; 154 | } 155 | 156 | dimension: previous_price { 157 | type: number 158 | sql: ${TABLE}."PREVIOUS_PRICE" ;; 159 | } 160 | 161 | dimension_group: price_recorded { 162 | type: time 163 | timeframes: [ 164 | raw, 165 | time, 166 | date, 167 | week, 168 | month, 169 | quarter, 170 | year 171 | ] 172 | sql: ${TABLE}."PRICE_RECORDED_AT" ;; 173 | } 174 | 175 | dimension_group: price_valid_until { 176 | type: time 177 | timeframes: [ 178 | raw, 179 | time, 180 | date, 181 | week, 182 | month, 183 | quarter, 184 | year 185 | ] 186 | sql: ${TABLE}."PRICE_VALID_UNTIL" ;; 187 | } 188 | 189 | dimension: retailer_id { 190 | type: number 191 | sql: ${TABLE}."RETAILER_ID" ;; 192 | } 193 | 194 | dimension: size { 195 | type: string 196 | sql: ${TABLE}."SIZE" ;; 197 | } 198 | 199 | dimension: sku { 200 | type: string 201 | sql: ${TABLE}."SKU" ;; 202 | } 203 | 204 | dimension: skus { 205 | type: string 206 | sql: ${TABLE}."SKUS" ;; 207 | } 208 | 209 | dimension: source_attributes { 210 | type: string 211 | sql: ${TABLE}."SOURCE_ATTRIBUTES" ;; 212 | } 213 | 214 | dimension: source_fragment { 215 | type: string 216 | sql: ${TABLE}."SOURCE_FRAGMENT" ;; 217 | } 218 | 219 | dimension: source_image_urls { 220 | type: string 221 | sql: ${TABLE}."SOURCE_IMAGE_URLS" ;; 222 | } 223 | 224 | dimension: univ_prod { 225 | type: string 226 | sql: ${TABLE}."UNIV_PROD" ;; 227 | } 228 | 229 | dimension_group: updated { 230 | type: time 231 | timeframes: [ 232 | raw, 233 | time, 234 | date, 235 | week, 236 | month, 237 | quarter, 238 | year 239 | ] 240 | sql: ${TABLE}."UPDATED_AT" ;; 241 | } 242 | 243 | dimension: wholelist { 244 | type: string 245 | sql: ${TABLE}."WHOLELIST" ;; 246 | } 247 | 248 | dimension: wholesaler_name { 249 | type: string 250 | sql: ${TABLE}."WHOLESALER_NAME" ;; 251 | } 252 | 253 | dimension: wholesaler_prod_id { 254 | type: string 255 | sql: ${TABLE}."WHOLESALER_PROD_ID" ;; 256 | } 257 | 258 | measure: count { 259 | type: count 260 | drill_fields: [id, wholesaler_name] 261 | } 262 | } 263 | -------------------------------------------------------------------------------- /throtle/attributes.view.lkml: -------------------------------------------------------------------------------- 1 | view: attributes { 2 | sql_table_name: marketing.public.attributes ;; 3 | 4 | dimension: id { 5 | type: string 6 | primary_key: yes 7 | sql: ${TABLE}.id ;; 8 | } 9 | 10 | dimension: email { 11 | type: string 12 | sql: ${TABLE}.email ;; 13 | } 14 | 15 | dimension: throtle_id { 16 | type: number 17 | sql: ${TABLE}.throtle_id::int ;; 18 | } 19 | 20 | dimension: birth_year { 21 | type: number 22 | sql: LEFT(${TABLE}.dob, 4)::int ;; 23 | } 24 | 25 | dimension: generation { 26 | type: string 27 | case: { 28 | when: { 29 | label: "Mature" 30 | sql: ${birth_year} < 1946;; 31 | } 32 | when: { 33 | label: "Baby Boomer" 34 | sql: ${birth_year} >= 1946 AND ${birth_year} <= 1964;; 35 | } 36 | when: { 37 | label: "Generation X" 38 | sql: ${birth_year} > 1964 AND ${birth_year} <= 1980;; 39 | } 40 | when: { 41 | label: "Millennial" 42 | sql: ${birth_year} > 1980 AND ${birth_year} <= 2000;; 43 | } 44 | else: "N/A" 45 | } 46 | } 47 | 48 | dimension: birth_month { 49 | type: number 50 | sql: RIGHT(${TABLE}.dob, 2)::int ;; 51 | } 52 | 53 | dimension: gender_raw { 54 | type: string 55 | hidden: yes 56 | sql: ${TABLE}.gender ;; 57 | } 58 | 59 | dimension: gender { 60 | type: string 61 | case: { 62 | when: { 63 | label: "Male" 64 | sql: ${gender_raw} = 'M' ;; 65 | } 66 | when: { 67 | label: "Female" 68 | sql: ${gender_raw} = 'F' ;; 69 | } 70 | else: "N/A" 71 | } 72 | } 73 | 74 | dimension: homeowner_raw { 75 | type: string 76 | hidden: yes 77 | sql: ${TABLE}.home_owner ;; 78 | } 79 | 80 | dimension: homeowner { 81 | type: string 82 | case: { 83 | when: { 84 | label: "Home Owner" 85 | sql: ${homeowner_raw} = 'Y' ;; 86 | } 87 | when: { 88 | label: "Renter" 89 | sql: ${homeowner_raw} = 'R' ;; 90 | } 91 | when: { 92 | label: "Probable Renter" 93 | sql: ${homeowner_raw} = 'P' ;; 94 | } 95 | when: { 96 | label: "Probable Home Owner" 97 | sql: ${homeowner_raw} = 'W' ;; 98 | } 99 | else: "N/A" 100 | } 101 | } 102 | 103 | dimension: income_raw { 104 | type: string 105 | hidden: yes 106 | sql: ${TABLE}.income ;; 107 | } 108 | 109 | dimension: income { 110 | type: string 111 | case: { 112 | when: { 113 | label: "< $10K" 114 | sql: ${income_raw} = 'A' ;; 115 | } 116 | when: { 117 | label: "$10,000 - $19,999" 118 | sql: ${income_raw} = 'B' ;; 119 | } 120 | when: { 121 | label: "$20 - $29,999" 122 | sql: ${income_raw} = 'C' ;; 123 | } 124 | when: { 125 | label: "$30 - $39,999" 126 | sql: ${income_raw} = 'D' ;; 127 | } 128 | when: { 129 | label: "$40 - $49,999" 130 | sql: ${income_raw} = 'E' ;; 131 | } 132 | when: { 133 | label: "$50 - $59,999" 134 | sql: ${income_raw} = 'F' ;; 135 | } 136 | when: { 137 | label: "$60 - $69,999" 138 | sql: ${income_raw} = 'G' ;; 139 | } 140 | when: { 141 | label: "$70 - $79,999" 142 | sql: ${income_raw} = 'H' ;; 143 | } 144 | when: { 145 | label: "$80 - $89,999" 146 | sql: ${income_raw} = 'I' ;; 147 | } 148 | when: { 149 | label: "$90 - $99,999" 150 | sql: ${income_raw} = 'J' ;; 151 | } 152 | when: { 153 | label: "$100 - $149,999" 154 | sql: ${income_raw} = 'K' ;; 155 | } 156 | when: { 157 | label: "$150 - $174,999" 158 | sql: ${income_raw} = 'L' ;; 159 | } 160 | when: { 161 | label: "$175 - $199,999" 162 | sql: ${income_raw} = 'M' ;; 163 | } 164 | when: { 165 | label: "$200 - $249,999" 166 | sql: ${income_raw} = 'N' ;; 167 | } 168 | when: { 169 | label: "$250K+" 170 | sql: ${income_raw} = 'O' ;; 171 | } 172 | else: "N/A" 173 | } 174 | } 175 | 176 | dimension: marital_status_raw { 177 | type: string 178 | hidden: yes 179 | sql: ${TABLE}.marital_status ;; 180 | } 181 | 182 | dimension: marital_status { 183 | type: string 184 | case: { 185 | when: { 186 | label: "Married" 187 | sql: ${marital_status_raw} = 'M' ;; 188 | } 189 | when: { 190 | label: "Single" 191 | sql: ${marital_status_raw} = 'S' ;; 192 | } 193 | else: "N/A" 194 | } 195 | } 196 | 197 | dimension: sports_raw { 198 | type: string 199 | hidden: yes 200 | sql: ${TABLE}.sports ;; 201 | } 202 | 203 | dimension: sports { 204 | type: string 205 | case: { 206 | when: { 207 | label: "Yes" 208 | sql: ${sports_raw} = '1' ;; 209 | } 210 | else: "No" 211 | } 212 | } 213 | 214 | dimension: travel_raw { 215 | type: string 216 | hidden: yes 217 | sql: ${TABLE}.travel ;; 218 | } 219 | 220 | dimension: travel { 221 | type: string 222 | case: { 223 | when: { 224 | label: "Yes" 225 | sql: ${travel_raw} = '1' ;; 226 | } 227 | else: "No" 228 | } 229 | } 230 | 231 | dimension: valuehunter_raw { 232 | type: string 233 | hidden: yes 234 | sql: ${TABLE}.valuehunter ;; 235 | } 236 | 237 | dimension: value_hunter { 238 | type: string 239 | case: { 240 | when: { 241 | label: "Yes" 242 | sql: ${valuehunter_raw} = 'Y' ;; 243 | } 244 | else: "No" 245 | } 246 | } 247 | } 248 | -------------------------------------------------------------------------------- /united/order_product.view.lkml: -------------------------------------------------------------------------------- 1 | include: "../drync/drync_united/order_product.view.lkml" 2 | include: "../tipsi/tipsi_united/order_product.view.lkml" 3 | include: "../bridge/bridge_united/order_product.view.lkml" 4 | 5 | 6 | 7 | # explore: order_product_bridge_useme { 8 | # from: order 9 | # label: "USE ME" 10 | # } 11 | view: order_product_united { 12 | view_label: "Order Items" 13 | # Or, you could make this view a derived table, like this: 14 | derived_table: { 15 | # datagroup_trigger: bridge_default 16 | sql: SELECT * FROM ${order_product_drync_united.SQL_TABLE_NAME} 17 | UNION 18 | SELECT * FROM ${order_product_tipsi_united.SQL_TABLE_NAME} 19 | UNION 20 | SELECT * FROM ${order_product_bridge_united.SQL_TABLE_NAME} 21 | ;; 22 | } 23 | 24 | dimension: id { 25 | label: "Line Item ID" 26 | type: number 27 | } 28 | 29 | dimension: pk_id { 30 | hidden: yes 31 | type: string 32 | primary_key: yes 33 | sql: ${source} || ${id} ;; 34 | } 35 | dimension: order_id {} 36 | 37 | dimension: source_order_id { 38 | hidden: yes 39 | type: string 40 | sql: ${source} || ${order_id} ;; 41 | } 42 | 43 | dimension: bottle_id {} 44 | 45 | dimension: source_bottle_id { 46 | hidden: yes 47 | type: string 48 | sql: ${source} || ${bottle_id} ;; 49 | } 50 | 51 | dimension: price_per_bottle { 52 | hidden: yes 53 | type: number 54 | } 55 | 56 | dimension: quantity { 57 | hidden: yes 58 | label: "Line Item Quantity" 59 | type: number 60 | } 61 | 62 | dimension: discount_per_bottle { 63 | hidden: yes 64 | type: number 65 | } 66 | 67 | dimension: source { 68 | type: string 69 | } 70 | 71 | dimension: order_list_price { 72 | hidden: yes 73 | type: number 74 | value_format_name: usd 75 | } 76 | 77 | dimension: line_item_list_price { 78 | hidden: yes 79 | type: number 80 | value_format_name: usd 81 | sql: ${price_per_bottle} * ${quantity} ;; 82 | } 83 | dimension: percent_of_order { 84 | hidden: yes 85 | type: number 86 | sql: ${line_item_list_price} / ${order_list_price} ;; 87 | value_format_name: percent_2 88 | } 89 | dimension: line_item_actual_price { 90 | hidden: yes 91 | type: number 92 | sql: ${orders_united.total_price_raw}*${percent_of_order} ;; 93 | } 94 | dimension: line_item_subtotal { 95 | hidden: yes 96 | type: number 97 | sql: ${orders_united.subtotal}*${percent_of_order} ;; 98 | } 99 | measure: total_subtotal { 100 | label: "Product Total" 101 | type: sum 102 | sql: ${line_item_subtotal} ;; 103 | value_format_name: usd 104 | drill_fields: [detail*] 105 | } 106 | dimension: line_item_tax { 107 | hidden: yes 108 | type: number 109 | sql:${orders_united.tax}*${percent_of_order} ;; 110 | } 111 | measure: total_tax { 112 | type: sum 113 | sql: ${line_item_tax} ;; 114 | value_format_name: usd 115 | 116 | drill_fields: [detail*] 117 | } 118 | dimension: line_item_deposit { 119 | hidden: yes 120 | type: number 121 | sql: ${orders_united.deposit}*${percent_of_order} ;; 122 | } 123 | measure: total_deposit { 124 | type: sum 125 | sql: ${line_item_deposit} ;; 126 | value_format_name: usd 127 | drill_fields: [detail*] 128 | } 129 | dimension: line_item_discount { 130 | hidden: yes 131 | type: number 132 | sql: ${orders_united.discount}*${percent_of_order} ;; 133 | } 134 | measure: total_discount { 135 | type: sum 136 | sql: ${line_item_discount} ;; 137 | value_format_name: usd 138 | drill_fields: [detail*] 139 | } 140 | dimension: line_item_net { 141 | type: number 142 | hidden: yes 143 | sql: (${line_item_subtotal} - ${line_item_discount} + ${line_item_deposit}) ;; 144 | } 145 | measure: net_total { 146 | type: sum 147 | sql: ${line_item_net} ;; 148 | value_format_name: usd 149 | drill_fields: [detail*] 150 | } 151 | dimension: fulfillment_method { 152 | sql: case when ${TABLE}.fulfillment_method = 'delivery' then 'Delivery' 153 | when ${TABLE}.fulfillment_method = 'shipping' then 'Shipping' 154 | when ${TABLE}.fulfillment_method = 'pickup' then 'Pickup' 155 | else ${TABLE}.fulfillment_method end 156 | ;; 157 | } 158 | measure: total_price { 159 | description: "Includes deposit, tax, discounts, shipping, delivery tip, and product costs" 160 | value_format_name: usd 161 | type: sum 162 | sql: ${line_item_actual_price} ;; 163 | drill_fields: [detail*] 164 | } 165 | 166 | measure: count { 167 | type: count 168 | } 169 | 170 | measure: order_count { 171 | type: count_distinct 172 | sql: ${order_id} ;; 173 | drill_fields: [detail*] 174 | } 175 | 176 | # measure: order_total { 177 | # label: "Total List Price" 178 | # hidden: yes 179 | # description: "DO NOT USE! Does not include shipping, discounts, tax, tip, or deposit. This is NOT the actual price paid for goods." 180 | # type: sum 181 | # sql: ${price_per_bottle} * ${quantity} ;; 182 | # value_format_name: usd 183 | # drill_fields: [detail*] 184 | # } 185 | 186 | measure: average_order_value { 187 | type: number 188 | sql: ${total_price} / nullif(${order_count},0) ;; 189 | value_format_name: usd 190 | drill_fields: [detail*] 191 | } 192 | 193 | measure: average_basket_size { 194 | description: "NOT SURE THIS IS CORRECT!! Takes an average of the line item quantity, without regard to bottle size" 195 | type: number 196 | sql: AVG(${quantity}) ;; 197 | value_format_name: decimal_0 198 | drill_fields: [detail*] 199 | } 200 | 201 | dimension: order_total_discount { 202 | hidden: yes 203 | description: "Only works at order level. Do not use when grouping on line item or product" 204 | type: number 205 | sql: ${quantity} * ${discount_per_bottle} ;; 206 | } 207 | 208 | measure: spend_per_user { 209 | type: number 210 | sql: (${total_price})/nullif(${orders_united.distinct_buyers},0);; 211 | value_format_name: usd 212 | drill_fields: [detail*] 213 | } 214 | 215 | set: detail { 216 | fields: [id,order_id, source, price_per_bottle,quantity,products_united.name, products_united.category, products_united.brand,products_united.size, count, total_price] 217 | } 218 | } 219 | -------------------------------------------------------------------------------- /bridge/api_winetbl.view.lkml: -------------------------------------------------------------------------------- 1 | view: api_winetbl_bridge { 2 | sql_table_name: "BRIDGE"."API_WINETBL" 3 | ;; 4 | drill_fields: [id] 5 | 6 | dimension: id { 7 | primary_key: yes 8 | type: number 9 | sql: ${TABLE}."ID" ;; 10 | } 11 | 12 | dimension_group: _sdc_batched { 13 | type: time 14 | timeframes: [ 15 | raw, 16 | time, 17 | date, 18 | week, 19 | month, 20 | quarter, 21 | year 22 | ] 23 | sql: ${TABLE}."_SDC_BATCHED_AT" ;; 24 | } 25 | 26 | dimension_group: _sdc_extracted { 27 | type: time 28 | timeframes: [ 29 | raw, 30 | time, 31 | date, 32 | week, 33 | month, 34 | quarter, 35 | year 36 | ] 37 | sql: ${TABLE}."_SDC_EXTRACTED_AT" ;; 38 | } 39 | 40 | dimension_group: _sdc_received { 41 | type: time 42 | timeframes: [ 43 | raw, 44 | time, 45 | date, 46 | week, 47 | month, 48 | quarter, 49 | year 50 | ] 51 | sql: ${TABLE}."_SDC_RECEIVED_AT" ;; 52 | } 53 | 54 | dimension: _sdc_sequence { 55 | type: number 56 | sql: ${TABLE}."_SDC_SEQUENCE" ;; 57 | } 58 | 59 | dimension: _sdc_table_version { 60 | type: number 61 | sql: ${TABLE}."_SDC_TABLE_VERSION" ;; 62 | } 63 | 64 | dimension: appellation_id { 65 | type: number 66 | sql: ${TABLE}."APPELLATION_ID" ;; 67 | } 68 | 69 | dimension: color_raw { 70 | type: number 71 | hidden: yes 72 | sql: ${TABLE}."COLOR" ;; 73 | } 74 | 75 | dimension: color { 76 | type: string 77 | case: { 78 | when: { 79 | label: "White" 80 | sql: ${color_raw} = 1 || 2 || 3 ;; 81 | } 82 | when: { 83 | label: "Rose" 84 | sql: ${color_raw} = 4 ;; 85 | } 86 | when: { 87 | label: "Red" 88 | sql: ${color_raw} = 5 || 6 || 7 ;; 89 | } 90 | } 91 | } 92 | 93 | dimension: country_id { 94 | type: number 95 | sql: ${TABLE}."COUNTRY_ID" ;; 96 | } 97 | 98 | dimension_group: created { 99 | type: time 100 | timeframes: [ 101 | raw, 102 | time, 103 | date, 104 | week, 105 | month, 106 | quarter, 107 | year 108 | ] 109 | sql: ${TABLE}."CREATED" ;; 110 | } 111 | 112 | dimension: custom_name { 113 | type: string 114 | sql: ${TABLE}."CUSTOM_NAME" ;; 115 | } 116 | 117 | dimension: designation_id { 118 | type: number 119 | sql: ${TABLE}."DESIGNATION_ID" ;; 120 | } 121 | 122 | dimension: display_label_url { 123 | type: string 124 | sql: ${TABLE}."DISPLAY_LABEL_URL" ;; 125 | } 126 | 127 | dimension: extra_appellation_id { 128 | type: number 129 | sql: ${TABLE}."EXTRA_APPELLATION_ID" ;; 130 | } 131 | 132 | dimension: is_junk { 133 | type: yesno 134 | sql: ${TABLE}."IS_JUNK" ;; 135 | } 136 | 137 | dimension: is_provider_wine { 138 | type: yesno 139 | sql: ${TABLE}."IS_PROVIDER_WINE" ;; 140 | } 141 | 142 | dimension: is_standard_size { 143 | type: yesno 144 | sql: ${TABLE}."IS_STANDARD_SIZE" ;; 145 | } 146 | 147 | dimension: label_url { 148 | type: string 149 | sql: ${TABLE}."LABEL_URL" ;; 150 | } 151 | 152 | dimension: name { 153 | type: string 154 | sql: ${TABLE}."NAME" ;; 155 | } 156 | 157 | dimension: price_retail { 158 | type: number 159 | sql: ${TABLE}."PRICE_RETAIL" ;; 160 | } 161 | 162 | dimension: provider_info_id { 163 | type: number 164 | sql: ${TABLE}."PROVIDER_INFO_ID" ;; 165 | } 166 | 167 | dimension: region_id { 168 | type: number 169 | sql: ${TABLE}."REGION_ID" ;; 170 | } 171 | 172 | dimension: sub_appellation_id { 173 | type: number 174 | sql: ${TABLE}."SUB_APPELLATION_ID" ;; 175 | } 176 | 177 | dimension: sub_region_id { 178 | type: number 179 | sql: ${TABLE}."SUB_REGION_ID" ;; 180 | } 181 | 182 | dimension: thumb_list_url { 183 | type: string 184 | sql: ${TABLE}."THUMB_LIST_URL" ;; 185 | } 186 | 187 | dimension: thumb_product_url { 188 | type: string 189 | sql: ${TABLE}."THUMB_PRODUCT_URL" ;; 190 | } 191 | 192 | dimension_group: tineye_upload { 193 | type: time 194 | timeframes: [ 195 | raw, 196 | time, 197 | date, 198 | week, 199 | month, 200 | quarter, 201 | year 202 | ] 203 | sql: ${TABLE}."TINEYE_UPLOAD_DATE" ;; 204 | } 205 | 206 | dimension: type_raw { 207 | type: number 208 | hidden: yes 209 | sql: ${TABLE}."TYPE" ;; 210 | } 211 | 212 | dimension: type { 213 | type: string 214 | case: { 215 | when: { 216 | label: "Regular" 217 | sql: ${type_raw} = 0 ;; 218 | } 219 | when: { 220 | label: "Fortified" 221 | sql: ${type_raw} = 1 ;; 222 | } 223 | when: { 224 | label: "Sparkling" 225 | sql: ${type_raw} = 2 ;; 226 | } 227 | when: { 228 | label: "Dessert" 229 | sql: ${type_raw} = 3 ;; 230 | } 231 | when: { 232 | label: "Off-Dry" 233 | sql: ${type_raw} = 4 ;; 234 | } 235 | } 236 | } 237 | 238 | dimension_group: updated { 239 | type: time 240 | timeframes: [ 241 | raw, 242 | time, 243 | date, 244 | week, 245 | month, 246 | quarter, 247 | year 248 | ] 249 | sql: ${TABLE}."UPDATED" ;; 250 | } 251 | 252 | dimension: validated { 253 | type: yesno 254 | sql: ${TABLE}."VALIDATED" ;; 255 | } 256 | 257 | dimension: varietal2_id { 258 | type: number 259 | sql: ${TABLE}."VARIETAL2_ID" ;; 260 | } 261 | 262 | dimension: varietal3_id { 263 | type: number 264 | sql: ${TABLE}."VARIETAL3_ID" ;; 265 | } 266 | 267 | dimension: varietal4_id { 268 | type: number 269 | sql: ${TABLE}."VARIETAL4_ID" ;; 270 | } 271 | 272 | dimension: varietal_id { 273 | type: number 274 | sql: ${TABLE}."VARIETAL_ID" ;; 275 | } 276 | 277 | dimension: vineyard_id { 278 | type: number 279 | sql: ${TABLE}."VINEYARD_ID" ;; 280 | } 281 | 282 | dimension: vintage { 283 | type: number 284 | sql: ${TABLE}."VINTAGE" ;; 285 | } 286 | 287 | dimension: wine_url { 288 | type: string 289 | sql: ${TABLE}."WINE_URL" ;; 290 | } 291 | 292 | dimension: winemakers_note { 293 | type: string 294 | sql: ${TABLE}."WINEMAKERS_NOTE" ;; 295 | } 296 | 297 | dimension: winemakers_note_source_url { 298 | type: string 299 | sql: ${TABLE}."WINEMAKERS_NOTE_SOURCE_URL" ;; 300 | } 301 | 302 | dimension: winery_id { 303 | type: number 304 | sql: ${TABLE}."WINERY_ID" ;; 305 | } 306 | 307 | measure: count { 308 | type: count 309 | drill_fields: [id, custom_name, name, color, type] 310 | } 311 | } 312 | -------------------------------------------------------------------------------- /drync/drync.explore.view.lkml: -------------------------------------------------------------------------------- 1 | include: "*.view.lkml" 2 | 3 | explore: product_clicked_drync { 4 | from: product_clicked 5 | group_label: "Drync" 6 | join: products_drync { 7 | type: inner 8 | relationship: many_to_one 9 | sql_on: ${product_clicked_drync.product_id} = ${products_drync.id} ;; 10 | } 11 | 12 | join: fulfillers { 13 | type: inner 14 | sql_on: ${product_clicked_drync.retailer_id} = ${fulfillers.short_name};; #retailer_id is not an int, would not match on fufiller.id WFD 10-7-2019 15 | relationship: many_to_one 16 | } 17 | 18 | join: organizations { 19 | from: organizations_drync 20 | type: inner 21 | sql_on: ${fulfillers.organization_id}=${organizations.id} ;; 22 | relationship: many_to_one 23 | } 24 | 25 | join: users_drync { 26 | type: inner 27 | sql_on: ${product_clicked_drync.user_id} = ${users_drync.id} ;; 28 | relationship: many_to_one 29 | } 30 | 31 | join: devices { 32 | from: devices_drync 33 | type: inner 34 | sql_on: ${users_drync.id} = ${devices.id} ;; 35 | relationship: many_to_one 36 | } 37 | 38 | join: orders { 39 | from: orders_drync 40 | type: inner 41 | sql_on: ${users_drync.id} = ${orders.user_id} ;; 42 | relationship: one_to_many 43 | } 44 | 45 | join: payments { 46 | type: left_outer 47 | relationship: many_to_one 48 | sql_on: ${orders.id} = ${payments.order_id} ;; 49 | 50 | } 51 | } 52 | 53 | explore: users_drync { 54 | group_label: "Drync" 55 | join: app_registrations { 56 | type: inner 57 | sql_on: ${app_registrations.user_id} = ${users_drync.id} ;; 58 | relationship: one_to_many 59 | } 60 | 61 | join: apps { 62 | type: inner 63 | sql_on: ${app_registrations.app_id} = ${apps.id} ;; 64 | relationship: many_to_one 65 | } 66 | 67 | join: app_sessions { 68 | type: left_outer 69 | relationship: one_to_many 70 | sql_on: ${apps.id} = ${app_sessions.app_id} AND ${app_sessions.user_id} = ${users_drync.id} ;; 71 | 72 | } 73 | join: devices { 74 | from: devices_drync 75 | type: inner 76 | sql_on: ${users_drync.id} = ${devices.user_id} ;; 77 | relationship: many_to_one 78 | } 79 | join: orders { 80 | from: orders_drync 81 | type: left_outer 82 | sql_on: ${users_drync.id} = ${orders.user_id} ;; 83 | relationship: one_to_many 84 | } 85 | 86 | join: payments { 87 | type: left_outer 88 | relationship: many_to_one 89 | sql_on: ${orders.id} = ${payments.order_id} ;; 90 | 91 | } 92 | 93 | join: shipments { 94 | type: left_outer 95 | sql_on: ${orders.id} = ${shipments.order_id} ;; 96 | relationship: one_to_many 97 | } 98 | 99 | join: line_items { 100 | type: left_outer 101 | sql_on: ${shipments.id} = ${line_items.shipment_id} ;; 102 | relationship: many_to_one 103 | } 104 | 105 | join: fulfillers { 106 | type: inner 107 | sql_on: ${orders.shopping_fulfiller_id} = ${fulfillers.id};; 108 | relationship: many_to_one 109 | } 110 | 111 | join: product_clicked { 112 | type: inner 113 | sql_on: ${product_clicked.user_id} = ${users_drync.id} ;; 114 | relationship: many_to_one 115 | } 116 | 117 | join: products_drync { 118 | type: inner 119 | sql_on: ${product_clicked.product_id} = ${products_drync.id} ;; 120 | relationship: many_to_one 121 | } 122 | } 123 | 124 | # explore: organizations { 125 | # from: organizations_drync 126 | # join: fulfillers { 127 | # type: inner 128 | # sql_on: ${organizations.id} = ${fulfillers.organization_id};; 129 | # relationship: one_to_many 130 | # } 131 | # } 132 | 133 | explore: fulfillers_drync { 134 | group_label: "Drync" 135 | from: fulfillers 136 | view_name: fulfillers 137 | join: organizations { 138 | from: organizations_drync 139 | type: inner 140 | sql_on: ${fulfillers.organization_id}=${organizations.id} ;; 141 | relationship: many_to_one 142 | } 143 | } 144 | 145 | explore: orders_drync { 146 | from: orders_drync 147 | group_label: "Drync" 148 | join: payments { 149 | type: left_outer 150 | relationship: many_to_one 151 | sql_on: ${orders_drync.id} = ${payments.order_id} ;; 152 | } 153 | } 154 | 155 | explore: products_drync { 156 | group_label: "Drync" 157 | } 158 | 159 | explore: devices_drync { 160 | group_label: "Drync" 161 | } 162 | 163 | explore: line_items { 164 | group_label: "Drync" 165 | join: shipments { 166 | type: left_outer 167 | sql_on: ${line_items.shipment_id} = ${shipments.id} ;; 168 | relationship: many_to_one 169 | } 170 | join: orders { 171 | from: orders_drync 172 | type: left_outer 173 | sql_on: ${shipments.order_id} = ${orders.id} ;; 174 | relationship: one_to_many 175 | } 176 | 177 | join: payments { 178 | type: left_outer 179 | relationship: many_to_one 180 | sql_on: ${orders.id} = ${payments.order_id} ;; 181 | 182 | } 183 | join: order_percentage { 184 | type: inner 185 | sql_on: ${orders.id} = ${order_percentage.order_id} ;; 186 | relationship: many_to_one 187 | } 188 | 189 | join: users_drync { 190 | view_label: "Users" 191 | type: left_outer 192 | sql_on: ${orders.user_id} = ${users_drync.id} ;; 193 | relationship: many_to_one 194 | } 195 | join: app_registrations { 196 | type: inner 197 | sql_on: ${app_registrations.user_id} = ${users_drync.id} ;; 198 | relationship: one_to_many 199 | } 200 | 201 | join: apps { 202 | type: inner 203 | sql_on: ${app_registrations.app_id} = ${apps.id} ;; 204 | relationship: many_to_one 205 | } 206 | 207 | join: app_sessions { 208 | type: left_outer 209 | relationship: one_to_many 210 | sql_on: ${apps.id} = ${app_sessions.app_id} AND ${app_sessions.user_id} = ${users_drync.id} ;; 211 | 212 | } 213 | 214 | join: devices { 215 | from: devices_drync 216 | type: inner 217 | sql_on: ${users_drync.id} = ${devices.user_id} ;; 218 | relationship: many_to_one 219 | } 220 | 221 | join: fulfillers { 222 | type: inner 223 | sql_on: ${orders.shopping_fulfiller_id} = ${fulfillers.id};; 224 | relationship: many_to_one 225 | } 226 | 227 | join: organizations { 228 | from: organizations_drync 229 | type: inner 230 | sql_on: ${fulfillers.organization_id}=${organizations.id} ;; 231 | relationship: many_to_one 232 | } 233 | 234 | join: products_drync { 235 | type: inner 236 | sql_on: ${line_items.bottle_id} = ${products_drync.id} ;; 237 | relationship: many_to_one 238 | } 239 | 240 | join: retailer_bottle_sources { 241 | type: left_outer 242 | sql_on: ${retailer_bottle_sources.id} = ${line_items.retailer_bottle_source_id} ;; 243 | relationship: one_to_many 244 | 245 | } 246 | } 247 | 248 | explore: order_items_base_drync {} 249 | --------------------------------------------------------------------------------