ရက်စွဲ - ၂၀၂၀ ဇူလိုင်လ
Dropbox ထဲက data files တွေကို Power BI Desktop ထဲမှာ data transforming လုပ်ဖို့၊ reports တွေ ထုတ်ကြည့်ဖို့ ဖြစ်နိုင်ပါတယ်။ ဒါပေမယ့် Power BI က built-in ခွင့်ပြုပေးထားတဲ့ data source lists ထဲမှာ မပါ၀င်တဲ့အတွက် custom connector တစ်ခုကိုတော့ အသုံးပြုပေး ရပါလိမ့်မယ်။ CData Software ကနေ ရောင်းပါတယ်။ Trial download လည်းပေးသုံးပါတယ်။ DropboxPowerBIConnector လို့ခေါ်ပါတယ်။
Step01: ပထမဆုံး trial download ဆွဲဖို့အတွက် email, country, company စတာတွေ ဖြည့်ပေးရပါတယ်။
Step02: ပုံမှန်အတိုင်းပါပဲ...download ဆွဲထားတဲ့ file ကို install လုပ်ပါ။
Fig (S02 – 01)
Step03: Name နဲ့ Email နှစ်ခုကို မဖြစ်မနေထည့်ပေးရပါမယ်။ Email တွေမပို့စေချင်ရင် အောက်မှာပြထားတဲ့ “Please send me ….” မှာ အမှန်ခြစ်ဖြုတ်ပေးခဲ့ပါ။
Step04: Install လုပ်ပြီးတဲ့အခါ ဘယ်လိုမျိုးသုံးရမလဲဆိုတဲ့ Help Documentation တစ်ခုပွင့်လာပါလိမ့်မယ်။ အခုရေးပြထားတာထက် documentation ထဲမှာ ပိုပြည့်စုံပါတယ်။
file:///C:/Program%20Files/CData/CData%20Power%20BI%20Connector%20for%20Dropbox/help/help.htm
Fig (S04 – 03)
Step05: Finish ကိုနှိပ်လိုက်တဲ့အခါ DSN Configuration box အလိုအလျောက် ပွင့်လာပါလိမ့်မယ်။ မိမိကိုယ်တိုင် DSN Configuration box ကိုဖွင့်ချင်ရင် =>
Win+Run>appwiz.cpl (or) Control Panel
Administrative Tools
ODBC Data Sources မှာ 32-bit ဒါမှမဟုတ် 64-bit တစ်ခုကိုရွေးပြီး ဖွင့်လိုက်ပါ။
System DSN tab ကိုသွားပါ။
Configure ကိုနှိပ်ပါ။
Fig (S05 – 04)
Step06: OAuth မှာ ဖြည့်ပေးစရာ ရှိပါတယ်။ အဲ့ဒီအတွက် Dropbox Developer Dashboard ကိုအရင်သွား ရပါမယ်။ https://www.dropbox.com/developers/apps ကိုသွားပါ။ ဒါမှမဟုတ် မိမိရဲ့ Power BI account ရဲ့ setting ကနေတစ်ဆင့်သွားလည်း ရပါတယ်။
Setting> Developers
Fig (S06 – 05A)
Fig (S06 – 05B)
Step07: Create app ကိုနှိပ်ပါ။ အောက်မှာပြထားတဲ့ အတိုင်းမြင်ရပါမယ်။
Fig (S07 – 06)
Step08: Choose an API မှာ Dropbox API ကိုရွေးပါ။
Fig (S08 – 07A)
Choose the type of access you need မှာ App folder ကိုပဲရွေးပါ။ Full access ဆိုရင် files တွေအရမ်းများတဲ့အခါ Power BI ပေါ်တင်တဲ့အခါ နည်းနည်း ခက်နိုင်လို့ပါ။
Fig (S08 – 07B)
Name your app မှာ မိမိစိတ်ကြိုက်နာမည် ပေးနိုင်ပါတယ်။ တစ်ခြားသူပေးထားပြီးသား နာမည် မဖြစ်ဖို့လိုပါတယ်။ Branding Guidelines နဲ့လည်းညီရပါမယ်။
Fig (S08 – 07C)
ပြီးရင် Create app ကိုနှိပ်လိုက်ပါ။
Step09: အောက်မှာပြထားတဲ့ပုံအတိုင်းပဲ App Key နဲ့ App secret ကိုတွေ့ရမှာ ဖြစ်ပါတယ်။ App secret ကိုမြင်ချင်ရင် Show ကိုနှိပ်လိုက်ပါ။
Step10: OAuth 2 မှာ Access token ကို generate လုပ်လိုက်ပါ။ Dropbox folder ထဲမှာလည်း Apps ဆိုတဲ့ folder တစ်ခုထပ်ရောက်လာပါ လိမ့်မယ်။
Step11: Apps folder မှာ Power BI desktop ကနေလှမ်းပြီး access လုပ်လိုတဲ့ files တွေကိုထည့်ထားလိုက်ပါ။
Step12: CData Power BI Connector for Dropbox – DSN Configuration box ကိုပြန်သွားပါ။ OAuth မှာ Dropbox မှာ create လုပ်ခဲ့တဲ့ App Key, App Secret နဲ့ Access Token တွေကို ထည့်ပါမယ်။
Step13: Test Connection နှိပ်ပြီး မှန်၊မမှန် စစ်ကြည့်နိုင်ပါတယ်။
Step14: OK နှိပ်ပြီး CData Power BI Connector for Dropbox – DSN Configuration box ကိုပိတ်လိုက်လို့ ရပါပြီ။
Step15: Power BI Desktop ကိုဖွင့်ပါ။ Get Data> More> Cdata Dropbox> Connect
Fig (S15 – 12)
Step16: Continue
Fig (S16 – 13A)
ODBC Data Source Administrator (64 bit) ထဲက System DSN နာမည်ကိုထည့်ပေးရပါမယ်။ ပြီးရင် Import (or) Direct Query တစ်ခုခုကိုရွေးပါ။ [အသေးစိတ်ကို ကျွန်မရဲ့ Power BI စာအုပ်မှာ ဖတ်နိုင်ပါတယ်။]
Fig (S16 – 13B)
Step17: OK and Connect
Fig (S17 – 14)
Step18: Step15 အဆင့်မှာ custom connector ကိုမချိတ်ဘဲ Blank Query ကိုယူလိုက်ပါ။ Advanced Editor ကနေ customized connector function ကို copy/paste လုပ်ပါ။ Function ကို invoke လုပ်တဲ့အချိန်မှာ Dropbox developer’s environment ကပေးလိုက်တဲ့ access token တစ်ခုပဲ ထည့်ပေးလိုက်ရင် ရပြီဖြစ်ပါတယ်။
Remark: Customized Connector Function ကပိုအဆင်ပြေပါတယ်။ ODBC box မှာ DSN setting ချိန်စရာ မလိုတော့ပါဘူး။
Customized Connector Function
let Source=
(token as text, optional folder as text) =>
let
data = [ path= if folder = null then "" else folder,
recursive=false,
include_media_info=false,
include_deleted=false,
include_has_explicit_shared_members=false
],
header = [ #"Authorization"="Bearer "&token,
#"Content-Type"= "application/json"],
response = Web.Contents("https://api.dropboxapi.com/2/files/list_folder",[Content=Json.FromValue(data),Headers=header]),
out = Json.Document(response,1252),
entries = out[entries],
ToTable = Table.FromList(entries, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
ExpandProperties = Table.ExpandRecordColumn(ToTable, "Column1", {".tag", "name", "path_lower", "path_display", "id", "client_modified", "server_modified", "rev", "size", "content_hash"}, {".tag", "name", "path_lower", "path_display", "id", "client_modified", "server_modified", "rev", "size", "content_hash"}),
RetrieveContent = Table.AddColumn(ExpandProperties, "File", each Web.Contents("https://content.dropboxapi.com/2/files/download",[
Headers=[#"Dropbox-API-Arg"="{""path"":"""&[path_display]&"""}", #"Authorization" = header[Authorization]]]))
in
RetrieveContent
,documentation = [
Documentation.Name = " fnDropbox.Folder
", Documentation.Description = " Returns a table with contents from your selected Dropbox folder
" , Documentation.LongDescription = " Returns a table with contents from your selected Dropbox folder. The optional field 'folder' allows you to access sub-folders within the main folder.
", Documentation.Category = " Accessing data functions
", Documentation.Source = " local
", Documentation.Author = " Imke Feldmann: www.TheBIccountant.com
", Documentation.Examples = {[Description = "
" , Code = " Check this blogpost explaining how it works: http://wp.me/p6lgsG-AA
", Result = "
"]}]
in
Value.ReplaceType(Source, Value.ReplaceMetadata(Value.Type(Source), documentation))
Noted by: Zaw May
20200718 (Sat)
No comments:
Post a Comment