title: saiku+kettle整合(一)环境准备 tags:
- olap categories: saiku date: 2016-08-25 18:18:55
环境准备
java等基本环境就无须赘述了,建议使用jdk7 对应的软件使用时增加sql-driver.jar
-
saiku使用ce版本,目前下载地址community.meteorite.bi/ 目前版本需要license免费申请即可
-
schema workbench图形化创建schema工具sourceforge.net/projects/mo…
-
kettle mac安装
brew
install
kettle
-
创建相关日期维度表
//Script here
//Create a Locale according to the specified language code
var locale = new java.util.Locale(
language_code.getString()
, country_code.getString()
);
//Create a calendar, use the specified initial date
var calendar = new java.util.GregorianCalendar(locale);
calendar.setTime(initial_date.getDate());
//set the calendar to the current date by adding DaySequence days
calendar.add(calendar.DAY_OF_MONTH,DaySequence.getInteger() - 1);
var simpleDateFormat = java.text.SimpleDateFormat("D",locale);
//get the calendar date
var date = new java.util.Date(calendar.getTimeInMillis());
simpleDateFormat.applyPattern("MM");
var month_number = simpleDateFormat.format(date);
simpleDateFormat.applyPattern("MMMM");
var month_name = simpleDateFormat.format(date);
simpleDateFormat.applyPattern("yyyy");
var year4 = "" + simpleDateFormat.format(date);
var quarter_number;
switch(parseInt(month_number)){
case 1: case 2: case 3: quarter_number = "1"; break;
case 4: case 5: case 6: quarter_number = "2"; break;
case 7: case 8: case 9: quarter_number = "3"; break;
case 10: case 11: case 12: quarter_number = "4"; break;
}
var date_key = DaySequence;
复制代码
-- ----------------------------
-- Table structure for `date_dim`
-- ----------------------------
DROP TABLE IF EXISTS `date_dim`;
CREATE TABLE `date_dim` (
`date_sk` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键,代理键',
`date` date DEFAULT NULL COMMENT '日期',
`month_name` varchar(9) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '月份名称',
`month` int(1) DEFAULT NULL COMMENT '月份',
`quarter` int(1) DEFAULT NULL COMMENT '季度',
`year` int(4) DEFAULT NULL COMMENT '年',
`effective_date` date DEFAULT NULL COMMENT '生效日期',
`expiry_date` date DEFAULT NULL COMMENT '到期日期',
`version` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`date_sk`)
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
复制代码
![095259_jamg_871390.png][]![095414_vYb2_871390.png][]
![095322_vtA9_871390.png][]![095404_wgse_871390.png][]
复制代码