關於ModeAnalytics的學習

不·一發表於2019-02-15

一、官方網站

https://modeanalytics.com
複製程式碼

####二、 DEMO頁面

demo
###三、 Let's Begin

1、連線資料庫

導航欄
選擇資料庫型別
image.png
填寫:

  • host ip地址
  • 資料庫名稱
  • 資料庫使用者名稱
  • 資料庫密碼

Mode can connect to your database in two ways: 官網介紹

  • Direct Connect: Mode will connect directly to your database over the public internet. This is the simplest way to connect, but may require your database or network to be configured to allow Mode’s servers to connect to it.
  • Bridge: Mode connects to your database with the assistance of a small helper application installed on a computer inside your network with direct access to your database. This solution lets Mode connect to your database even if it’s not publicly accessible.

備註:

為了能讓mode連線到你的本地資料庫,需要利用橋接模式(安裝相應的dmg軟體)
複製程式碼
2、編寫sql語句

demo

關於編寫sql語句 引數相關demo

SELECT orders.occurred_at::DATE AS "Date",
       orders.id AS "Order ID",
       orders.standard_amt_usd AS "Standard",
       orders.gloss_amt_usd AS "Glossy",
       orders.poster_amt_usd AS "Poster"
FROM demo.orders
JOIN demo.accounts
  ON accounts.id=orders.account_id
JOIN demo.sales_reps
  ON sales_reps.id=accounts.sales_rep_id
JOIN demo.orders__fulfillments
  ON orders__fulfillments.order_id=orders.id
JOIN demo.region on region.id=sales_reps.region_id
  WHERE orders.occurred_at >= '{{ order_start_date }}'
    AND orders.occurred_at <= '{{ order_end_date }}'
    AND region.name in ({{ sales_region }})
    AND orders.total_amt_usd >= {{ order_min }}
    AND orders.total_amt_usd <= {{ order_max }}
    AND orders__fulfillments.shipment_status = '{{ shipment_status }}'
    AND accounts.sales_rep_id in ({{ sales_rep }})


{% form %}

order_start_date:
  type: date
  default: 2016-01-01
  description: Only display results for orders placed after this date
  
order_end_date:
  type: date
  default: 2016-12-31
  description: Only display results for orders placed before this date
  
sales_region:
  type: multiselect
  default: [Northeast,West]
  description: Display results for one or more sales regions
  input_type: string
  options: [Northeast,Midwest,West,Southeast]
    
order_min:
  type: text
  default: 0
  label: Minimum Order Amt ($)
  description: Only display results for orders over this amount

order_max:
  type: text
  default: 1000
  label: Maximum Order Amt ($)
  description: Only display results for orders less than this amount
  
shipment_status:
  type: select
  default: delivered
  options: [delivered,failure]
  
{% endform %}
複製程式碼

report
report

相關文章