Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
lookering committed Apr 23, 2018
0 parents commit aa90e29
Show file tree
Hide file tree
Showing 16 changed files with 863 additions and 0 deletions.
29 changes: 29 additions & 0 deletions categories.view.lkml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
view: categories {
sql_table_name: Northwind2.Categories ;;

dimension: category_id {
primary_key: yes
type: number
sql: ${TABLE}.CategoryID ;;
}

dimension: category_name {
type: string
sql: ${TABLE}.CategoryName ;;
}

dimension: description {
type: string
sql: ${TABLE}.Description ;;
}

dimension: picture {
type: string
sql: ${TABLE}.Picture ;;
}

measure: count {
type: count
drill_fields: [category_id, category_name]
}
}
19 changes: 19 additions & 0 deletions customer_customer_demo.view.lkml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
view: customer_customer_demo {
sql_table_name: Northwind2.CustomerCustomerDemo ;;

dimension: customer_id {
type: string
# hidden: yes
sql: ${TABLE}.CustomerID ;;
}

dimension: customer_type_id {
type: string
sql: ${TABLE}.CustomerTypeID ;;
}

measure: count {
type: count
drill_fields: [customers.contact_name, customers.company_name, customers.customer_id]
}
}
18 changes: 18 additions & 0 deletions customer_demographics.view.lkml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
view: customer_demographics {
sql_table_name: Northwind2.CustomerDemographics ;;

dimension: customer_desc {
type: string
sql: ${TABLE}.CustomerDesc ;;
}

dimension: customer_type_id {
type: string
sql: ${TABLE}.CustomerTypeID ;;
}

measure: count {
type: count
drill_fields: []
}
}
65 changes: 65 additions & 0 deletions customers.view.lkml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
view: customers {
sql_table_name: Northwind2.Customers ;;

dimension: customer_id {
primary_key: yes
type: string
sql: ${TABLE}.CustomerID ;;
}

dimension: address {
type: string
sql: ${TABLE}.Address ;;
}

dimension: city {
type: string
sql: ${TABLE}.City ;;
}

dimension: company_name {
type: string
sql: ${TABLE}.CompanyName ;;
}

dimension: contact_name {
type: string
sql: ${TABLE}.ContactName ;;
}

dimension: contact_title {
type: string
sql: ${TABLE}.ContactTitle ;;
}

dimension: country {
type: string
map_layer_name: countries
sql: ${TABLE}.Country ;;
}

dimension: fax {
type: string
sql: ${TABLE}.Fax ;;
}

dimension: phone {
type: string
sql: ${TABLE}.Phone ;;
}

dimension: postal_code {
type: string
sql: ${TABLE}.PostalCode ;;
}

dimension: region {
type: string
sql: ${TABLE}.Region ;;
}

measure: count {
type: count
drill_fields: [customer_id, contact_name, company_name, customer_customer_demo.count, orders.count]
}
}
19 changes: 19 additions & 0 deletions employee_territories.view.lkml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
view: employee_territories {
sql_table_name: Northwind2.EmployeeTerritories ;;

dimension: employee_id {
type: number
# hidden: yes
sql: ${TABLE}.EmployeeID ;;
}

dimension: territory_id {
type: string
sql: ${TABLE}.TerritoryID ;;
}

measure: count {
type: count
drill_fields: [employees.first_name, employees.last_name, employees.employee_id]
}
}
121 changes: 121 additions & 0 deletions employees.view.lkml
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
view: employees {
sql_table_name: Northwind2.Employees ;;

dimension: employee_id {
primary_key: yes
type: number
sql: ${TABLE}.EmployeeID ;;
}

dimension: address {
type: string
sql: ${TABLE}.Address ;;
}

dimension_group: birth {
type: time
timeframes: [
raw,
time,
date,
week,
month,
quarter,
year
]
sql: ${TABLE}.BirthDate ;;
}

dimension: city {
type: string
sql: ${TABLE}.City ;;
}

dimension: country {
type: string
map_layer_name: countries
sql: ${TABLE}.Country ;;
}

dimension: extension {
type: string
sql: ${TABLE}.Extension ;;
}

dimension: first_name {
type: string
sql: ${TABLE}.FirstName ;;
}

dimension_group: hire {
type: time
timeframes: [
raw,
time,
date,
week,
month,
quarter,
year
]
sql: ${TABLE}.HireDate ;;
}

dimension: home_phone {
type: string
sql: ${TABLE}.HomePhone ;;
}

dimension: last_name {
type: string
sql: ${TABLE}.LastName ;;
}

dimension: notes {
type: string
sql: ${TABLE}.Notes ;;
}

dimension: photo {
type: string
sql: ${TABLE}.Photo ;;
}

dimension: photo_path {
type: string
sql: ${TABLE}.PhotoPath ;;
}

dimension: postal_code {
type: string
sql: ${TABLE}.PostalCode ;;
}

dimension: region {
type: string
sql: ${TABLE}.Region ;;
}

dimension: reports_to {
type: number
sql: ${TABLE}.ReportsTo ;;
}

dimension: title {
type: string
sql: ${TABLE}.Title ;;
}

dimension: title_of_courtesy {
type: string
sql: ${TABLE}.TitleOfCourtesy ;;
}
dimension: Employees_name {
type: string
sql: CONCAT(${first_name}, ' ', ${last_name}) ;;
}
measure: count {
type: count
drill_fields: [employee_id, first_name, last_name, employee_territories.count, orders.count]
}
}
117 changes: 117 additions & 0 deletions gintare.model.lkml
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
connection: "northwind_2"

# include all the views
include: "*.view"

# include all the dashboards
include: "*.dashboard"

datagroup: northwind_challenge_default_datagroup {
# sql_trigger: SELECT MAX(id) FROM etl_log;;
max_cache_age: "1 hour"
}

persist_with: northwind_challenge_default_datagroup

explore: categories {}

explore: customer_customer_demo {
join: customers {
type: left_outer
sql_on: ${customer_customer_demo.customer_id} = ${customers.customer_id} ;;
relationship: many_to_one
}
}

explore: customer_demographics {}

explore: customers {
join: orders {
type: left_outer
sql_on: ${customers.customer_id} = ${orders.customer_id} ;;
relationship: one_to_many
}
}

explore: employee_territories {
join: employees {
type: left_outer
sql_on: ${employee_territories.employee_id} = ${employees.employee_id} ;;
relationship: many_to_one
}
}

explore: employees {}

explore: order_details {
join: orders {
type: left_outer
sql_on: ${order_details.order_id} = ${orders.order_id} ;;
relationship: many_to_one
}

join: products {
type: left_outer
sql_on: ${order_details.product_id} = ${products.product_id} ;;
relationship: many_to_one
}
}

explore: orders {
join: employees {
type: left_outer
sql_on: ${orders.employee_id} = ${employees.employee_id} ;;
relationship: many_to_one
}

join: customers {
type: left_outer
sql_on: ${orders.customer_id} = ${customers.customer_id} ;;
relationship: many_to_one
}
join: order_details {
type: left_outer
sql_on: ${orders.order_id}=${order_details.order_id} ;;
relationship: one_to_many
}
}

explore: products {
join: suppliers {
type: left_outer
sql_on: ${products.supplier_id} = ${suppliers.supplier_id} ;;
relationship: many_to_one
}
join: order_details {
type: left_outer
sql_on: ${products.product_id}=${order_details.product_id} ;;
relationship: one_to_many
}
join: categories {
type: left_outer
sql_on: ${products.category_id}=${categories.category_id} ;;
relationship: many_to_one
}
}

explore: region {}

explore: shippers {
join: orders {
type: left_outer
sql_on: ${shippers.shipper_id}=${orders.ship_via} ;;
relationship: one_to_many
}
}

explore: suppliers {}

explore: territories {
join: region {
type: left_outer
sql_on: ${territories.region_id} = ${region.region_id} ;;
relationship: many_to_one
}
}

explore: usstates {}
Loading

0 comments on commit aa90e29

Please sign in to comment.