windows 10安裝 superset 集成kylin2.5.0

Superset 是一個數據探索和可視化平臺,設計用來提供直觀的,可視化的,交互式的分析體驗,專一於數據可視化展示。
Superset 提供了兩種分析數據源的方式:
1. 用戶能夠以單表形式直接查詢多種數據源,包括 Presto、Hive、Impala、SparkSQL、MySQL、Postgres、Oracle、Redshift、SQL Server、Druid 、kylin等數據源。
2. 一個 SQL 的 IDE 供高級分析師使用 SQL 查詢定義所須要分析的數據集,這種方法使用戶在一個查詢中實現用 Superset 查詢數據源的多表,並當即對查詢進行可視化分析。python

安裝python3.6

此過程簡單,下載對應OS版本安裝便可。c++

安裝virtualenv

Superset須要安裝的組件較多,最好是使用virtualenv獨立一套python環境
D:\python\Anaconda3>pip install virtualenv
Collecting virtualenv
  Downloading https://files.pythonhosted.org/packages/7c/17/9b7b6cddfd255388b58c61e25b091047f6814183e1d63741c8df8dcd65a2/virtualenv-16.1.0-py2.py3-none-any.whl (1.9MB)
    100% |████████████████████████████████| 1.9MB 2.2MB/s
Installing collected packages: virtualenv
Successfully installed virtualenv-16.1.0sql

自定義 D:\python\Anaconda3\myprojects 目錄
D:\python\Anaconda3>cd D:\python\Anaconda3\myprojects
初始化
D:\python\Anaconda3\myprojects>virtualenv env
Using base prefix 'd:\\python\\anaconda3'
New python executable in D:\python\Anaconda3\myprojects\env\Scripts\python.exe
Installing setuptools, pip, wheel...
done.數據庫

激活,激活後界面命令行有env標識,後續操做也可在env中生效,不會影響總體Python環境。
D:\python\Anaconda3\myprojects>env\Scripts\activatejson

(env) D:\python\Anaconda3\myprojects>app

安裝Microsoft visual c++ 14.0
不然會在安裝superset過程當中報以下錯誤
error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": http://landinghub.visualstudio.com/visual-cpp-build-tools
可今後百度網盤下載,從給的連接微軟官方下載安裝太麻煩
https://pan.baidu.com/s/1WaBxFghTll6Zofz1DGOZBg
安裝後須要重啓機器dom

安裝sasl
直接經過pip install sasl安裝時若是沒有安裝Microsoft visual c++ 14.0也會報錯
error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": http://landinghub.visualstudio.com/visual-cpp-build-tools
可本身去以下網站下載python及操做系統對應版本的.whl包進行安裝
http://www.lfd.uci.edu/~gohlke/pythonlibs/#sasl
下載後安裝
D:\python\Anaconda3>pip install myprojects\sasl-0.2.1-cp36-cp36m-win_amd64.whl
Processing d:\python\anaconda3\myprojects\sasl-0.2.1-cp36-cp36m-win_amd64.whl
Requirement already satisfied: six in d:\python\anaconda3\lib\site-packages (from sasl==0.2.1) (1.10.0)
Installing collected packages: sasl
Successfully installed sasl-0.2.1編輯器

安裝superset
(env) D:\python\Anaconda3\myprojects>pip install superset
Collecting superset
......
  Running setup.py install for superset ... done
Successfully installed cchardet-2.1.4 et-xmlfile-1.0.1 ijson-2.3 jdcal-1.4 jsonlines-1.2.0 jsonschema-2.6.0 linear-tsv-1.1.0 openpyxl-2.4.11 pure-sasl-0.5.1 python-geohash-0.8.5 pyyaml-3.13 rfc3986-1.2.0 simplejson-3.16.0 sqlalchemy-utils-0.33.9 sqlparse-0.2.4 superset-0.28.1 tableschema-1.3.0 tabulator-1.19.0 thrift-0.11.0 thrift-sasl-0.3.0 unicodecsv-0.14.1 unidecode-1.0.23 xlrd-1.2.0ide

建立管理員賬號
(env) D:\python\Anaconda3\myprojects>fabmanager create-admin --app superset
Username [admin]: admin
User first name [admin]: admin
User last name [user]: admin
Email [admin@fab.org]:
Password:
Repeat for confirmation:
Recognized Database Authentications.
Admin User admin created.測試

初始化數據庫 (先進入到virtualEnv的虛擬目錄下,Lib\site-packages\superset\bin下)
(env) D:\python\Anaconda3\myprojects>cd D:\python\Anaconda3\myprojects\env\Lib\site-packages\superset\bin

(env) D:\python\Anaconda3\myprojects\env\Lib\site-packages\superset\bin>python superset db upgrade
INFO  [alembic.runtime.migration] Context impl SQLiteImpl.
......
INFO  [alembic.runtime.migration] Running upgrade 0c5070e96b57 -> 1a1d627ebd8e, position_json
INFO  [alembic.runtime.migration] Running upgrade 1a1d627ebd8e -> 55e910a74826, add_metadata_column_to_annotation_model.py
 

安裝自帶實例
(env) D:\python\Anaconda3\myprojects\env\Lib\site-packages\superset\bin>python superset load_examples
Loading examples into <SQLA engine=sqlite:///C:\Users\huafeng.fang\.superset\superset.db>
Creating default CSS templates
Loading energy related dataset
Creating table [wb_health_population] reference
2018-12-17 13:49:24,861:INFO:root:Creating database reference
2018-12-17 13:49:24,924:INFO:root:Database.get_sqla_engine(). Masked URL: sqlite:///C:\Users\huafeng.fang\.superset\superset.db
Loading [World Bank's Health Nutrition and Population Stats]
Creating table [wb_health_population] reference
2018-12-17 13:55:07,350:INFO:root:Creating database reference
Creating slices
Creating a World's Health Bank dashboard
Loading [Birth names]
Done loading table!
--------------------------------------------------------------------------------
Creating table [birth_names] reference
2018-12-17 13:55:09,191:INFO:root:Creating database reference
Creating some slices
Creating a dashboard
Loading [Random time series data]
Done loading table!
--------------------------------------------------------------------------------
Creating table [random_time_series] reference
2018-12-17 13:55:10,083:INFO:root:Creating database reference
Creating a slice
Loading [Random long/lat data]
Done loading table!
--------------------------------------------------------------------------------
Creating table reference
2018-12-17 13:55:22,340:INFO:root:Creating database reference
Creating a slice
Loading [Country Map data]
Done loading table!
--------------------------------------------------------------------------------
Creating table reference
2018-12-17 13:55:22,504:INFO:root:Creating database reference
Creating a slice
Loading [Multiformat time series]
Done loading table!
--------------------------------------------------------------------------------
Creating table [multiformat_time_series] reference
2018-12-17 13:55:22,676:INFO:root:Creating database reference
Creating Heatmap charts
Loading [Paris GeoJson]
Creating table paris_iris_mapping reference
2018-12-17 13:55:24,438:INFO:root:Creating database reference
Loading [San Francisco population polygons]
Creating table sf_population_polygons reference
2018-12-17 13:55:24,569:INFO:root:Creating database reference
Loading [Flights data]
2018-12-17 13:55:27,395:INFO:root:Creating database reference
Done loading table!
Loading [BART lines]
Creating table bart_lines reference
2018-12-17 13:55:27,528:INFO:root:Creating database reference
Loading [Multi Line]
Creating table [wb_health_population] reference
2018-12-17 13:55:35,318:INFO:root:Creating database reference
Creating slices
Creating a World's Health Bank dashboard
Done loading table!
--------------------------------------------------------------------------------
Creating table [birth_names] reference
2018-12-17 13:55:36,941:INFO:root:Creating database reference
Creating some slices
Creating a dashboard
Loading [Misc Charts] dashboard
Creating the dashboard
Loading DECK.gl demo
Loading deck.gl dashboard
Creating Scatterplot slice
Creating Screen Grid slice
Creating Hex slice
Creating Grid slice
Creating Polygon slice
Creating Arc slice
Creating Path slice
Creating a dashboard

初始化角色和權限
(env) D:\python\Anaconda3\myprojects\env\Lib\site-packages\superset\bin>python superset init
2018-12-17 13:56:27,513:INFO:root:Creating database reference
2018-12-17 13:56:27,513:INFO:root:Syncing role definition
2018-12-17 13:56:27,622:INFO:root:Syncing Admin perms
2018-12-17 13:56:27,733:INFO:root:Syncing Alpha perms
2018-12-17 13:56:28,115:INFO:root:Syncing Gamma perms
2018-12-17 13:56:28,473:INFO:root:Syncing granter perms
2018-12-17 13:56:28,778:INFO:root:Syncing sql_lab perms
2018-12-17 13:56:29,142:INFO:root:Fetching a set of all perms to lookup which ones are missing
2018-12-17 13:56:29,212:INFO:root:Creating missing datasource permissions.
2018-12-17 13:56:29,212:INFO:root:Creating missing database permissions.
2018-12-17 13:56:29,259:INFO:root:Creating missing metrics permissions
2018-12-17 13:56:29,274:INFO:root:Cleaning faulty perms

初始化角色和權限
(env) D:\python\Anaconda3\myprojects\env\Lib\site-packages\superset\bin>python superset init
2018-12-17 13:56:27,513:INFO:root:Creating database reference
2018-12-17 13:56:27,513:INFO:root:Syncing role definition
2018-12-17 13:56:27,622:INFO:root:Syncing Admin perms
2018-12-17 13:56:27,733:INFO:root:Syncing Alpha perms
2018-12-17 13:56:28,115:INFO:root:Syncing Gamma perms
2018-12-17 13:56:28,473:INFO:root:Syncing granter perms
2018-12-17 13:56:28,778:INFO:root:Syncing sql_lab perms
2018-12-17 13:56:29,142:INFO:root:Fetching a set of all perms to lookup which ones are missing
2018-12-17 13:56:29,212:INFO:root:Creating missing datasource permissions.
2018-12-17 13:56:29,212:INFO:root:Creating missing database permissions.
2018-12-17 13:56:29,259:INFO:root:Creating missing metrics permissions
2018-12-17 13:56:29,274:INFO:root:Cleaning faulty perms

啓動服務,端口 8088, 使用 -p 更改端口號
(env) D:\python\Anaconda3\myprojects\env\Lib\site-packages\superset\bin>python superset runserver -d
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Starting Superset server in DEBUG mode
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

2018-12-17 13:57:02,821:INFO:werkzeug: * Restarting with stat
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Starting Superset server in DEBUG mode
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

2018-12-17 13:57:05,340:WARNING:werkzeug: * Debugger is active!
2018-12-17 13:57:05,340:INFO:werkzeug: * Debugger PIN: 483-986-611
2018-12-17 13:57:05,356:INFO:werkzeug: * Running on http://0.0.0.0:8088/ (Press CTRL+C to quit)

配置的用戶密碼登陸

與kylin集成

安裝kylinpy
(env) D:\python\Anaconda3\myprojects>pip install --upgrade kylinpy
Collecting kylinpy
Requirement already satisfied, skipping upgrade: click<7,>=6.7 in d:\python\anaconda3\myprojects\env\lib\site-packages (from kylinpy) (6.7)
Installing collected packages: kylinpy
Successfully installed kylinpy-2.1.2

不然建立kylin數據源使會提示
sqlalchemy.exc.NoSuchModuleError: Can't load plugin: sqlalchemy.dialects:kylin
2018-12-17 14:18:39,516:INFO:werkzeug:127.0.0.1 - - [17/Dec/2018 14:18:39] "POST /superset/testconn HTTP/1.1" 500 -

安裝後重啓superset,測試數據源添加成功

添加數據表

在SQL編輯器中執行SQL

相關文章
相關標籤/搜索