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 查询数据源的多表,并立即对查询进行可视化分析。

安装python3.6

此过程简单,下载对应OS版本安装即可。

安装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.0

自定义 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\activate

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

安装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
安装后需要重启机器

安装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.0

创建管理员帐号
(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
[34m-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
[33mStarting Superset server in [31mDEBUG[33m mode
[34m-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
[0m
2018-12-17 13:57:02,821:INFO:werkzeug: * Restarting with stat
[34m-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
[33mStarting Superset server in [31mDEBUG[33m mode
[34m-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
[0m
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)

配置的用户密码登录

b4da761da84dbfff2468119b6696e48bade.jpg

与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 -

6824a51bcb6e69070b7725ff9752df1148a.jpg

安装后重启superset,测试数据源添加成功

e845bbe4e16f6536254843e12033f68af3d.jpg

00b4d1f31ef6786a3e2dc6335f2c6878b42.jpg

添加数据表

b1eeb9cc2626a5eff8c0d4d758e43f85dc3.jpg

在SQL编辑器中执行SQL

d0350cd878c140ee630933880166aec071a.jpg

 

 

转载于:https://my.oschina.net/peakfang/blog/2989738

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值