微信搜索lxw1234bigdata | 邀请体验:数阅–数据管理、OLAP分析与可视化平台 | 赞助作者:赞助作者

Caravel–一款开源OLAP+数据可视化分析前端工具,支持Druid和Kylin

Kylin lxw1234@qq.com 67911℃ 13评论

关键词:caravel、olap、kylin、数据可视化

Caravel(曾用名Panoramix),是由知名在线房屋短租公司Airbnb开源的一款数据探索与可视化工具,该工具在可视化、易用性和交互性上非常有特色,用户可以轻松对数据进行可视化分析。官网地址为: http://airbnb.io/caravel/

Caravel介绍

Caravel底层使用Python开发,与SQLAlchemy深度整合,目前原生支持的数据源有:

MySQL、Postgres、Presto、Oracle、sqlite、Redshift、MSSQL以及Druid。对于前面的关系型数据库,Caravel通过将界面的操作转换成SQL语句,提交给SQLAlchemy适配数据源查询并返回结果,对于Druid,Caravel将界面的操作转换成Druid的API进行查询并返回结果,与Druid的深度集成,可以实现大规模海量数据的OLAP分析和实时探索。

另外,为了提高并发查询下的性能,还支持数据缓存,可配置将数据缓存至Redis、Memcache或者本地文件系统。

Caravel支持十几种可视化图表,用于将查询返回的数据做可视化展示:

caravel

Caravel安装并支持Apache Kylin

 

如果你的数据源是上面介绍的几种,那么可以直接使用Caravel。但我们数据平台中的OLAP引擎为Apache Kylin,所以需要简单的修改和开发。

由于Caravel使用SQLAlchemy适配数据源并提交查询,因此我们的思路为,将Kylin作为一个数据库引擎注册进SQLAlchemy,然后由Caravel自动适配并执行。而将Kylin查询注册到SQLAlchemy,网上已经有人开源了代码:https://github.com/wxiang7/pykylin(感谢作者Wu Xiang)。

接下来先安装Caravel,http://airbnb.io/caravel/installation.html,再安装pykylin,https://github.com/wxiang7/pykylin。

启动Caravel Server: caravel runserver -d

使用浏览器打开:http://localhost:8088,使用admin/admin登陆。

Caravel使用

创建数据源(Databases)

caravel

caravel

这里需要注意Sqlalchemy Uri的写法:

kylin://ADMIN:KYLIN@172.16.212.17:7070/kylin/api?project=lxw1234

Kylin中的project名称,需要以URL参数的方式传递。

点击”TEST CONNECTION”,提示测试连接成功,并且在最下方,列出了project中所有的表。

 

如果使用MySQL数据库,配置如下:

caravel

添加表(Tables)

数据源创建好之后,就可以添加数据源中的表。

caravel

caravel

其中,Database选择之前创建好的数据源,Table Name必须是数据源中对应真实的表名。

需要注意的是,该表中必须有一个日期或时间类型的字段。

SAVE之后,进入到Table List页面。

caravel

点击上面的Edit record按钮,可以编辑该表的字段及指标属性:

caravel

在List Table Column页面中,指定那些字段可以GroupBy,那些可以过滤,那些可以Count Distinct,那些可以Sum、Min、Max,那些字段属于时间序列字段(Is Dttm)。

caravel

在List Sql Metric页面,可以编辑和定义指标,如果上面对一些字段勾选了Sum、Min、Max、Count Distinct选项,则这里会自动生成相应的指标字段。

数据探索分析与可视化展示

在针对一个Table,定义好维度字段和指标之后,即可针对该表进行数据探索分析与可视化展示,在List Table页面,点击一个表名,即可进入:

caravel

如下图,在分析页面中,可以针对某一个表事先定义的时间字段、维度及指标字段进行数据探索分析,并可以选择相应的图表进行可视化展示。

caravel

另外,可以将一个定制好的数据探索保存成Slice,多个Slice可以组成一个Dashboard。

caravel

定制自己的Dashboard

在添加Dashboard页面,指定包含哪些Slice,定制自己的Dashboard。

caravel

caravel

其中,每个Slice对应的模块,可以自由拖拽位置和大小,并保存整个Dashboard的布局。

关于Caravel for Kylin

我和我的朋友Rocky,正在整理相关的修改,后面将放到github或者提交到Caravel。

你可以先使用已支持的数据源来体验和使用Caravel。

 

 

 

 

 

如果觉得本博客对您有帮助,请 赞助作者

转载请注明:lxw的大数据田地 » Caravel–一款开源OLAP+数据可视化分析前端工具,支持Druid和Kylin

喜欢 (92)
分享 (0)
发表我的评论
取消评论
表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
(13)个小伙伴在吐槽
  1. linux自带python2.6重安装python2.7后,pip安装caravel报错: SystemError: Cannot compile 'Python.h'. Perhaps you need to install python-dev|python-devel 但是已经yum install gcc libffi-devel python-devel python-pip python-wheel openssl-devel命令安装了
    qinzl_12016-06-23 18:26 回复
  2. 不支持中文列怎么办
    repo2016-06-29 11:39 回复
  3. 请问字段编辑那 支持将kylin中string字段变成caravel中的date类型吗?
    木子简2016-08-10 12:12 回复
  4. 看了自带折线图的sql发现自己join自己,而且并没有多关联出什么信息,不知道为什么折线图生成的sql为什么设定成这样: eg:自带slices中的 Growth Rate SELECT country_name AS country_name, year AS timestamp, SUM("SP_POP_TOTL") AS "sum__SP_POP_TOTL" FROM wb_health_population JOIN (SELECT country_name AS country_name__ FROM wb_health_population WHERE year >= '1960-01-01 00:00:00.000000' AND year = '1960-01-01 00:00:00.000000' AND year <= '2014-01-01 00:00:00.000000' GROUP BY country_name, year ORDER BY "sum__SP_POP_TOTL" DESC LIMIT 50000 OFFSET 0
    木子简2016-08-10 17:03 回复
  5. 你好,我根据你的步骤安装caravel-kylin失败,sudo /usr/local/python2.7/bin/caravel db upgrade 2016-08-12 11:45:50,091:INFO:flask_appbuilder.base:Registering class CssTemplateModelView on menu CSS Templates INFO [alembic.runtime.migration] Context impl SQLiteImpl. INFO [alembic.runtime.migration] Will assume non-transactional DDL. INFO [alembic.runtime.migration] Running upgrade 4fa88fe24e94 -> c3a8f8611885, Materializing permission Traceback (most recent call last): File "/usr/local/python2.7/bin/caravel", line 109, in manager.run() File "/usr/local/python2.7/lib/python2.7/site-packages/flask_script/__init__.py", line 412, in run result = self.handle(sys.argv[0], sys.argv[1:]) File "/usr/local/python2.7/lib/python2.7/site-packages/flask_script/__init__.py", line 383, in handle res = handle(*args, **config) File "/usr/local/python2.7/lib/python2.7/site-packages/flask_script/commands.py", line 216, in __call__ return self.run(*args, **kwargs) File "/usr/local/python2.7/lib/python2.7/site-packages/flask_migrate/__init__.py", line 200, in upgrade command.upgrade(config, revision, sql=sql, tag=tag) File "/usr/local/python2.7/lib/python2.7/site-packages/alembic/command.py", line 174, in upgrade script.run_env() File "/usr/local/python2.7/lib/python2.7/site-packages/alembic/script/base.py", line 397, in run_env util.load_python_file(self.dir, 'env.py') File "/usr/local/python2.7/lib/python2.7/site-packages/alembic/util/pyfiles.py", line 93, in load_python_file module = load_module_py(module_id, path) File "/usr/local/python2.7/lib/python2.7/site-packages/alembic/util/compat.py", line 79, in load_module_py mod = imp.load_source(module_id, path, fp) File "/usr/local/python2.7/lib/python2.7/site-packages/caravel/migrations/env.py", line 90, in run_migrations_online() File "/usr/local/python2.7/lib/python2.7/site-packages/caravel/migrations/env.py", line 83, in run_migrations_online context.run_migrations() File "", line 8, in run_migrations File "/usr/local/python2.7/lib/python2.7/site-packages/alembic/runtime/environment.py", line 797, in run_migrations self.get_context().run_migrations(**kw) File "/usr/local/python2.7/lib/python2.7/site-packages/alembic/runtime/migration.py", line 312, in run_migrations step.migration_fn(**kw) File "/usr/local/python2.7/lib/python2.7/site-packages/caravel/migrations/versions/c3a8f8611885_materializing_permission.py", line 21, in upgrade op.add_column('slices', sa.Column('perm', sa.String(length=2000), nullable=True)) File "", line 8, in add_column File "", line 3, in add_column File "/usr/local/python2.7/lib/python2.7/site-packages/alembic/operations/ops.py", line 1535, in add_column return operations.invoke(op) File "/usr/local/python2.7/lib/python2.7/site-packages/alembic/operations/base.py", line 318, in invoke return fn(self, operation) File "/usr/local/python2.7/lib/python2.7/site-packages/alembic/operations/toimpl.py", line 123, in add_column schema=schema File "/usr/local/python2.7/lib/python2.7/site-packages/alembic/ddl/impl.py", line 172, in add_column self._exec(base.AddColumn(table_name, column, schema=schema)) File "/usr/local/python2.7/lib/python2.7/site-packages/alembic/ddl/impl.py", line 118, in _exec return conn.execute(construct, *multiparams, **params) File "/usr/local/python2.7/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 914, in execute return meth(self, multiparams, params) File "/usr/local/python2.7/lib/python2.7/site-packages/sqlalchemy/sql/ddl.py", line 68, in _execute_on_connection return connection._execute_ddl(self, multiparams, params) File "/usr/local/python2.7/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 968, in _execute_ddl compiled File "/usr/local/python2.7/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1146, in _execute_context context) File "/usr/local/python2.7/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1341, in _handle_dbapi_exception exc_info File "/usr/local/python2.7/lib/python2.7/site-packages/sqlalchemy/util/compat.py", line 202, in raise_from_cause reraise(type(exception), exception, tb=exc_tb, cause=cause) File "/usr/local/python2.7/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1139, in _execute_context context) File "/usr/local/python2.7/lib/python2.7/site-packages/sqlalchemy/engine/default.py", line 450, in do_execute cursor.execute(statement, parameters) sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) duplicate column name: perm [SQL: u'ALTER TABLE slices ADD COLUMN perm VARCHAR(2000)'] 请问是为什么呢?是哪个地方有问题?
    wo80002016-08-12 11:50 回复
  6. 博主,您好,安装好caravel之后,caravel与kylin进行整合的时候,出现如下错误: ERROR:Traceback (most recent call last): … … … NoSuchModuleError: Can’t load plugin: sqlalchemy.dialects:kylin 请问怎么解决啊?
    icichacici2016-10-08 14:00 回复
    • 这个问题你解决了吗,我也遇到了
      77抽筋le2017-06-28 14:53 回复
  7. 请问下博主,在assets文件夹下 npm install 总是报错总是报shasum check failed for /tmp/npm-20600-0cd471b1/registry.npmjs.org/datamaps/-/datamaps-0.4.4.tgz 这个问题,是因为网络的原因还是前面安装配置的问题哈
    tc7926178712016-10-24 14:17 回复
  8. 连接上了,但是没有Kylin项目中的表啊
    bing2016-10-25 17:12 回复
  9. 2016-12-22 15:50:41,229:ERROR:root:u'TIMESTAMP(0)' Traceback (most recent call last): File "/usr/local/bin/python27/lib/python2.7/site-packages/superset/views.py", line 694, in pre_add table.get_sqla_table_object() File "/usr/local/bin/python27/lib/python2.7/site-packages/superset/models.py", line 1176, in get_sqla_table_object return self.database.get_table(self.table_name, schema=self.schema) File "/usr/local/bin/python27/lib/python2.7/site-packages/superset/models.py", line 835, in get_table autoload_with=self.get_sqla_engine()) File "/usr/local/bin/python27/lib/python2.7/site-packages/sqlalchemy/sql/schema.py", line 416, in __new__ metadata._remove_table(name, schema) File "/usr/local/bin/python27/lib/python2.7/site-packages/sqlalchemy/util/langhelpers.py", line 60, in __exit__ compat.reraise(exc_type, exc_value, exc_tb) File "/usr/local/bin/python27/lib/python2.7/site-packages/sqlalchemy/sql/schema.py", line 411, in __new__ table._init(name, metadata, *args, **kw) File "/usr/local/bin/python27/lib/python2.7/site-packages/sqlalchemy/sql/schema.py", line 484, in _init self._autoload(metadata, autoload_with, include_columns) File "/usr/local/bin/python27/lib/python2.7/site-packages/sqlalchemy/sql/schema.py", line 496, in _autoload self, include_columns, exclude_columns File "/usr/local/bin/python27/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1972, in run_callable return conn.run_callable(callable_, *args, **kwargs) File "/usr/local/bin/python27/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1477, in run_callable return callable_(self, *args, **kwargs) File "/usr/local/bin/python27/lib/python2.7/site-packages/sqlalchemy/engine/default.py", line 364, in reflecttable return insp.reflecttable(table, include_columns, exclude_columns) File "/usr/local/bin/python27/lib/python2.7/site-packages/sqlalchemy/engine/reflection.py", line 563, in reflecttable table_name, schema, **table.dialect_kwargs): File "/usr/local/bin/python27/lib/python2.7/site-packages/sqlalchemy/engine/reflection.py", line 369, in get_columns **kw) File "/usr/local/bin/python27/lib/python2.7/site-packages/pykylin-0.0.1-py2.7.egg/pykylin/dialect.py", line 158, in get_columns return [self._map_column_type(c) for c in cols] File "/usr/local/bin/python27/lib/python2.7/site-packages/pykylin-0.0.1-py2.7.egg/pykylin/dialect.py", line 172, in _map_column_type tpe = KYLIN_TYPE_MAP[tpe_NAME] KeyError: u'TIMESTAMP(0)' 遇到时间字段就报错了。有什么解决办法么?博主
    Jonathan2016-12-22 16:32 回复
  10. 现在它又改名字啦,新的版本是:https://github.com/airbnb/superset,LZ的修改的插件还是支持么? 另外想请教下这个插件理否支持Kylin2.x版本呢?
    凡梦星尘2017-05-17 11:25 回复
  11. 刚开始只安装了kylinpy,后来又安装了pykylin,一直提示如下 Can't load plugin: sqlalchemy.dialects:kylin
    咸鱼一条2019-02-20 16:35 回复
  12. 这应该就是superset 吧
    贺呵呵2019-11-06 09:53 回复