mondrian4 kylin saiku 整合踩坑记录
2017-12-13 本文已影响19人
鬼魅魑魅
先说了版本:
Mondrian 4 、kylin2.2 、saiku 3.15
saiku 3.15
使用的xml是基于 mondrian4 的schema的xml。网上大多数文章是介绍mondrian3的schema语法的
Mondrian4 :
官方地址:
https://github.com/pentaho/mondrian > 打包出来的mondrian-8.1版本
网上很多文章的mondrian schema的xml 是基于Mondrian3 的。
mondrian 4 与mondrian3 的schema的对比:
- 判断是不是mondrian4:
- schema 标签 从mondrian4 开始加入了metamodelVersion,mondrian4.0 的标签如下:
- 多了PhysicalSchema、Attributes标签
- mondrian4 的schema.xml语法:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Schema SYSTEM "mondrian.dtd" >
<Schema metamodelVersion="4.0">
<!-- Define how the DB tables are set up -->
<PhysicalSchema>
<!-- Specify source tables -->
<Table/>
<!-- Define relationships between snowflake or alias tables, not direct dim tables! -->
<Link/>
</PhysicalSchema>
<!-- Create your cube definition and reference back to the physical schema -->
<Cube>
<!-- Define dimensions and attributes -->
<Dimensions>
<Dimension>
<Attribute/>
</Dimension>
<Hierarchies>
<Hierarchy>
<Level/>
</Hierarchy>
</Hierarchies>
</Dimensions>
<!-- Define Measures -->
<MeasureGroups>
<MeasureGroup>
<Measures>
<Measure/>
</Measures>
<DimensionLinks>
<ForeignKeyLink/>
<FactLink/>
</DimensionLinks>
</MeasureGroup>
</MeasureGroups>
<!-- Define Calculated Members and Names Sets -->
<CalculatedMembers/>
<NamedSets/>
</Cube>
<!-- If you have conformed dimensions, specify them globally.-->
<Dimension>
<!-- Define roles below to restrict access to the cube(s). -->
<Role>
</Schema>
- mondrian3 的schema.xml语法:
<Schema>
<Cube name="Sales">
<Table name="sales_fact_1997"/>
<Dimension name="Gender" foreignKey="customer_id">
<Hierarchy hasAll="true" allMemberName="All Genders" primaryKey="customer_id">
<Table name="customer"/>
<Level name="Gender" column="gender" uniqueMembers="true"/>
</Hierarchy>
</Dimension>
<Dimension name="Time" foreignKey="time_id">
<Hierarchy hasAll="false" primaryKey="time_id">
<Table name="time_by_day"/>
<Level name="Year" column="the_year" type="Numeric" uniqueMembers="true"/>
<Level name="Quarter" column="quarter" uniqueMembers="false"/>
<Level name="Month" column="month_of_year" type="Numeric" uniqueMembers="false"/>
</Hierarchy>
</Dimension>
<Measure name="Unit Sales" column="unit_sales" aggregator="sum" formatString="#,###"/>
<Measure name="Store Sales" column="store_sales" aggregator="sum" formatString="#,###.##"/>
<Measure name="Store Cost" column="store_cost" aggregator="sum" formatString="#,###.00"/>
<CalculatedMember name="Profit" dimension="Measures" formula="[Measures].[Store Sales] - [Measures].[Store Cost]">
<CalculatedMemberProperty name="FORMAT_STRING" value="$#,##0.00"/>
</CalculatedMember>
</Cube>
</Schema>
官方文档:
- mondrian 4 官方(多了head):https://mondrian.pentaho.com/head/documentation/schema.php 注意:页面里面的左侧菜单是没有head的,可能是没有head的最新内容
百度Google搜索到的都是mondrian3版本的。
参考资料
mondrian4:
- https://diethardsteiner.blogspot.com/2013/01/mondrian-4-get-ready.html
- mondrian 官方schema.xml 文档 https://mondrian.pentaho.com/head/documentation/schema.php
- 《Mondrian in Action》 是基于mondrian4
- 下载地址1: https://pan.baidu.com/s/1nvkma7Z 密码: p6wv
- 下载地址2:http://pdf.th7.cn/down/files/1312/Mondrian%20in%20Action.pdf
mondrian3
- mondrian 官方schema:https://mondrian.pentaho.com/documentation/schema.php