Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Debugging BI Stack : MySQL + Mondrian + Saiku server

I'm trying to learn how to build a BI stack, but I'm stuck at understanding what part of the process failed :

  1. Designing a star schema : done
  2. Loading data from my OLTP database (MySQL) to my star database (MySQL too) : done with Pentaho Data Integration
  3. Making a Mondrian XML description the cube : done with Mondrian Schema Workbench
  4. Setuping a Saiku server with the correct configuration using the Mondrian XML description and the MySQL star database : done

Result : no cube appears in Saiku. I don't know from which element this might come from. Step 2 is correct, since I can run this part.

Here's my star schema :

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`);

My Mondrian XML is (size is missing) :

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

My connection with Saiku server is done through :

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

I wrote this one considering the foodmart sample provided and the documentation of saiku.

Where should I look ? What can I do to see what is not working ? What is the professional way of developing a BI infrastructure ?

like image 456
AsTeR Avatar asked Oct 22 '22 20:10

AsTeR


1 Answers

I'm not 100 % operational since query failed to be executed but saiku now loads.

First point : tomcat/saiku/catalina.out contains the interesting log information for debugging. Second point : location string in the saiku configuration did point to a missing file, that didn't help. Third point : dimension tables should be mentionned in Mondrian's XML (the correct version follows).

<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>
like image 111
AsTeR Avatar answered Oct 30 '22 16:10

AsTeR