我正在尝试学习如何构建BI堆栈,但我无法理解过程的哪一部分失败了:
结果:Saiku中没有出现立方体。我不知道这可能来自哪个元素。第2步是正确的,因为我可以运行这部分。
这是我的星型模式:
CREATE TABLE IF NOT EXISTS `dim_date` (
`date_id` int(11) NOT NULL AUTO_INCREMENT,
`date` datetime DEFAULT NULL,
`month` varchar(3) DEFAULT NULL,
`year` varchar(4) DEFAULT NULL,
PRIMARY KEY (`date_id`),
KEY `idx_dim_date_lookup` (`date`,`month`,`year`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
CREATE TABLE IF NOT EXISTS `dim_sector` (
`sector_id` int(11) NOT NULL AUTO_INCREMENT,
`sector` varchar(255) DEFAULT NULL,
PRIMARY KEY (`sector_id`),
KEY `idx_dim_sector_lookup` (`sector`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
CREATE TABLE IF NOT EXISTS `dim_size` (
`size_id` int(11) NOT NULL AUTO_INCREMENT,
`size` varchar(10) DEFAULT NULL,
PRIMARY KEY (`size_id`),
KEY `idx_dim_size_lookup` (`size`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
CREATE TABLE IF NOT EXISTS `fact_companies` (
`fact_id` int(11) NOT NULL AUTO_INCREMENT,
`count` int(11) NOT NULL,
`date_id` int(11) NOT NULL,
`sector_id` int(11) NOT NULL,
`size_id` int(11) NOT NULL,
PRIMARY KEY (`fact_id`),
KEY `date_id` (`date_id`),
KEY `sector_id` (`sector_id`),
KEY `size_id` (`size_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
ALTER TABLE `fact_companies`
ADD CONSTRAINT `fact_companies_ibfk_1` FOREIGN KEY (`date_id`) REFERENCES `dim_date` (`date_id`),
ADD CONSTRAINT `fact_companies_ibfk_2` FOREIGN KEY (`sector_id`) REFERENCES `dim_sector` (`sector_id`),
ADD CONSTRAINT `fact_companies_ibfk_3` FOREIGN KEY (`size_id`) REFERENCES `dim_size` (`size_id`);
我的蒙德里安XML是(尺寸缺失):
<Schema name="New Schema1">
<Cube name="companies_cube" visible="true" cache="true" enabled="true">
<Table name="fact_companies">
</Table>
<Dimension type="TimeDimension" visible="true" foreignKey="date_id" name="date">
<Hierarchy name="All" visible="true" hasAll="true" allMemberName="all" allMemberCaption="all" allLevelName="all">
<Level name="Date" visible="true" table="dim_date" column="date" nameColumn="date" uniqueMembers="false">
</Level>
<Level name="Month" visible="true" table="dim_date" column="month" nameColumn="month" uniqueMembers="false">
</Level>
<Level name="Year" visible="true" table="dim_date" column="year" nameColumn="year" uniqueMembers="false">
</Level>
</Hierarchy>
</Dimension>
<Dimension type="StandardDimension" visible="true" foreignKey="sector_id" name="Sector">
<Hierarchy name="Sector" visible="true" hasAll="true" primaryKey="sector_id" primaryKeyTable="sector_id">
<Level name="Sector" visible="true" table="dim_sector" column="sector_id" nameColumn="sector" uniqueMembers="false">
</Level>
</Hierarchy>
</Dimension>
<Measure name="count companies" column="count" aggregator="sum" visible="true">
</Measure>
</Cube>
</Schema>
我与Saiku服务器的连接是通过以下方式完成的:
type=OLAP
name=test
driver=mondrian.olap4j.MondrianOlap4jDriver
location=jdbc:mondrian:Jdbc=jdbc:mysql://192.168.1.43/testdb;Catalog=res:test/testdb.xml;JdbcDrivers=com.mysql.jdbc.Driver;
username=test
password=test
我写这一个考虑到食物市场提供的样本和saiku的留档。
我应该看哪里?我能做些什么来看看什么不起作用?开发BI基础设施的专业方式是什么?
我不是100%操作,因为查询未能执行,但saiku现在加载。
第一点:tomcat/saiku/catalina. out包含有趣的调试日志信息。第二点:saiku配置中的位置字符串确实指向了一个丢失的文件,这没有帮助。第三点:在Mondrian的XML中应该提到维度表(正确的版本如下)。
<Schema name="New Schema1">
<Cube name="companies_cube" visible="true" cache="true" enabled="true">
<Table name="fact_companies">
</Table>
<Dimension type="TimeDimension" visible="true" foreignKey="date_id" highCardinality="false" name="date">
<Hierarchy name="Date" visible="true" hasAll="true" allMemberName="all dates" allMemberCaption="all dates" allLevelName="all dates">
<Table name="dim_date">
</Table>
<Level name="Year" visible="true" table="dim_date" column="year" nameColumn="year" type="String" uniqueMembers="false" levelType="TimeYears" hideMemberIf="Never">
</Level>
<Level name="Month" visible="true" table="dim_date" column="month" nameColumn="month" type="String" uniqueMembers="false" levelType="TimeMonths" hideMemberIf="Never">
</Level>
<Level name="Date" visible="true" table="dim_date" column="date" nameColumn="date" type="String" uniqueMembers="false" levelType="TimeDays" hideMemberIf="Never">
</Level>
</Hierarchy>
</Dimension>
<Dimension type="StandardDimension" visible="true" foreignKey="sector_id" highCardinality="false" name="Sector">
<Hierarchy name="Sector" visible="true" hasAll="true" allMemberName="all sector" allMemberCaption="all sector" allLevelName="all sector" primaryKey="sector_id">
<Table name="dim_sector" alias="">
</Table>
<Level name="Sector" visible="true" table="dim_sector" column="sector_id" nameColumn="sector" type="String" uniqueMembers="false" levelType="Regular" hideMemberIf="Never">
</Level>
</Hierarchy>
</Dimension>
<Measure name="count companies" column="count" aggregator="sum" visible="true">
</Measure>
</Cube>
</Schema>