postgresqlsaiku

How can use another database instead of foodmart


I am not much familiar with saiku reporting. When I run the saiku reporting this display cube for foodmart db. But I want to use database from postgresql. For that I made one connection file. Added driver.jar file in to web-inf/lib folder. But I cant seen database in cube.

What we can only use foodmart database ? Cant we use another database?


Solution

  • Sample Data

    Create sample data in PostgreSQL:

    create table olap_data(id serial, measure int, dim varchar);
    
    insert into olap_data (measure, dim) select * from generate_series(1,10) cross join (values ('a'), ('b'),('c')) a;
    
    select * from olap_data;
    

    Connection File

    Add connection file (name does not matter, I'm using dummy_test).

    Destination: /saiku-server/tomcat/webapps/saiku/WEB-INF/classes/saiku-datasources/dummy_test

    Content:

    type=OLAP
    name=Financial
    driver=mondrian.olap4j.MondrianOlap4jDriver
    location=jdbc:mondrian:Jdbc=jdbc:postgresql://localhost:5432/tgr; \
    Catalog=/home/Applications/Saiku/saiku-server/tomcat/webapps/saiku/WEB-INF/classes/foodmart/dummy_cube.xml;JdbcDrivers=org.postgresql.Driver;
    username=YourUsername
    password=YourPassword
    

    Do not forget to set correct connection string, username and password.

    Add OLAP schema definition

    Destination: /home/Applications/Saiku/saiku-server/tomcat/webapps/saiku/WEB-INF/classes/foodmart/dummy_cube.xml (has to match path defined in data source definition file).

    Content:

    <Schema name="New Schema1">
      <Cube name="Sample Cube" visible="true" cache="true" enabled="true">
        <Table name="olap_data" schema="public">
        </Table>
        <Dimension type="StandardDimension" visible="true" foreignKey="id" name="Sample Dimension">
          <Hierarchy name="Sample Hiearchy" visible="true" hasAll="true">
            <Table name="olap_data" schema="public">
            </Table>
            <Level name="Sample Level" visible="true" column="dim" uniqueMembers="false">
            </Level>
          </Hierarchy>
        </Dimension>
        <Measure name="Measure" column="measure" aggregator="sum" visible="true">
        </Measure>
      </Cube>
    </Schema>
    

    Make it work

    Restart Saiku

    Clear cache from browser

    Now you should see sample cube in Saikuenter image description here