Adventure項目python、數(shù)倉實現(xiàn)可視化看板總結(jié)

一、項目介紹

1.1項目需求

基于第一部分業(yè)務(wù)背景,公司為加強線上業(yè)務(wù)數(shù)據(jù)化方面的治理,讓業(yè)務(wù)部門能夠?qū)崿F(xiàn)自主分析從而實現(xiàn)對市場的快速判斷,現(xiàn)需使用Python、數(shù)據(jù)倉庫實現(xiàn)自動更新式可視化看板。

1.2項目操作流程
image.png
1.3項目流程框架
BI項目流程框架 .png

Adventure—BI看板

根據(jù)上述項目介紹,以下主要從數(shù)倉獲取數(shù)據(jù)、自動化py腳本處理、可視化報表搭建、自動化更新看板數(shù)據(jù)四方面簡要介紹下操作過程。

二、簡要操作過程
1、數(shù)倉獲取數(shù)據(jù)
(1)操作概要

Python通過配置文件database.py中,連接mysql中的ods數(shù)據(jù)庫抽取數(shù)據(jù)。

(2)操作過程

數(shù)倉獲取數(shù)據(jù)


image.png
2、自動化py腳本處理
(1)操作概要

通過Python對ods基礎(chǔ)數(shù)據(jù)層數(shù)據(jù)進行加工處理,生成相應(yīng)的dw報表。

(2)操作過程
dw_order_by_day.py(每日銷售匯總&環(huán)比表)
image.png
dw_order_diff.py(每日銷售同比表)
image.png
dw_customer_order.py(每日時間產(chǎn)品地區(qū)聚合表-流水表)
image.png
3、可視化報表搭建
(1)操作概要

主要從時間、地區(qū)、產(chǎn)品等維度,設(shè)計銷售額、訂單量、客單價、同環(huán)比等關(guān)鍵性指標,實現(xiàn)銷售總體情況,銷售時間趨勢、銷售區(qū)域分布的可視化報表展示。

(2)操作過程
銷售總體情況展示:
銷售總體情況展示

銷售總體情況操作
銷售時間趨勢展示:
銷售時間趨勢展示
銷售時間趨勢操作
銷售區(qū)域分布展示:
銷售區(qū)域分布展示

銷售區(qū)域分布操作

4、自動化更新看板數(shù)據(jù)

(1)操作概要

通過linux服務(wù)器上部署代碼,并通過powerbi連接相應(yīng)mysql數(shù)據(jù)庫實現(xiàn)每日定時更新數(shù)據(jù)

(2)操作過程

Xshell登錄百度云服務(wù)器,進行l(wèi)inux相關(guān)命令操作:

1、進入并查看文件夾下信息
cd aventure_Ben
ls
(base) [frog005@instance-grq6ue3x ~]$ cd adventure_Ben
(base) [frog005@instance-grq6ue3x adventure_Ben]$ ls
Ben_logs     dw_order_by_day_multiprocessing.py  dw_order_diff.py                   log.py       schedule_job_Ben.log  select_data_by_multiprocessing.py
database.py  dw_order_by_day.py                  insert_data_by_multiprocessing.py  __pycache__  schedule_job_Ben.py   update_sum_data.py

2、查看schedule程序目前運行情況
ps aux| grep schedule_job_Ben.py
(base) [frog005@instance-grq6ue3x adventure_Ben]$ ps aux| grep schedule_job_Ben.py
frog005   1342  0.0  0.0 112708   972 pts/1    S+   16:52   0:00 grep --color=auto schedule_job_Ben.py

此時沒有程序掛起

3、將schedule程序掛在后臺執(zhí)行,并輸出日志:
nohup python3 schedule_job_Ben.py > schedule_job_Ben2.log 2>&1 &
(base) [frog005@instance-grq6ue3x adventure_Ben]$  nohup python3 schedule_job_Ben.py > schedule_job_Ben2.log 2>&1 &
[1] 1409

掛在后臺的程序代號為1409

4、查看該schedule程序目前運行情況(驗證是否順利掛在后臺?)
ps aux| grep schedule_job_Ben.py
(base) [frog005@instance-grq6ue3x adventure_Ben]$ ps aux| grep schedule_job_Ben.py
frog005   1409  0.9  0.2 150832 23072 pts/1    S    16:57   0:00 python3 schedule_job_Ben.py

程序順利掛在后臺,代號為1409的程序等待運行。

5、時間已過schedule程序定時時間,查看該schedule程序目前運行情況
ps aux| grep schedule_job_Ben.py
(base) [frog005@instance-grq6ue3x adventure_Ben]$ ps aux| grep schedule_job_Ben.py
frog005  21944  0.0  0.2 151000 18708 ?        S    Jun28   0:24 python3 schedule_job_Ben.py
frog005   1409  0.0  0.0 112708   972 pts/1    S+   16:58   0:00 grep --color=auto schedule_job_Ben.py

程序運行結(jié)束

6、查看相關(guān)程序日志情況
cat update_sum_data.log
image.png

image.png

后臺程序運行成功,PowerBI每日刷新實現(xiàn)數(shù)據(jù)更新。

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

友情鏈接更多精彩內(nèi)容