我的表格结构如下
dim_question_tbl table with primary key dim_question_id_i(pk)
dim_grade_tbl -> dim_grade_id_i(pk), grade_name_c
dim_level_tbl -> dim_level_id_i(pk), level_name_c
dim_grade_question_tbl -> dim_grade_question_id_i(pk), dim_grade_id_i(fk), dim_level_id_i(fk)
现在我必须将等级和等级作为维度的等级。
在'dim_question_tbl'表上写的多维数据集。
我已将尺寸写为
<Dimension name="Grade" foreignKey="dim_question_id_i" highCardinality="false">
<Hierarchy hasAll="true" primaryKey="dim_question_id_i" primaryKeyTable="dim_grade_question_tbl">
<join leftKey="dim_grade_id_i" rightKey="dim_grade_id_i">
<table name="dim_grade_question_tbl" />
<join leftKey="dim_level_id_i" rightKey="dim_level_id_i">
<table name="dim_grade_tbl" />
<table name="dim_level_tbl" />
</join>
</join>
<Level name="EnterpriseID" column="dim_enterprise_id_i" table="dim_grade_tbl" uniqueMembers="true" visible="false"/>
<Level name="Grade" column="grade_name_c" table="dim_grade_tbl" uniqueMembers="true"/>
<Level name="Level" column="level_name_c" table="dim_level_tbl" uniqueMembers="true"/>
</Hierarchy>
</Dimension>
这不起作用。我得到的例外是“[等级]”必须至少有一个级别。
我已经尝试过使用sql查询
<Dimension name="Grade" foreignKey="dim_question_id_i" highCardinality="false">
<Hierarchy hasAll="true" primaryKey="dim_question_id_i" primaryKeyTable="dim_grade_question_tbl">
<Query name="test">
<SQL dialect="generic">
SELECT *
FROM dim_grade_question_tbl, dim_grade_tbl, dim_level_tbl
WHERE dim_grade_question_tbl.dim_grade_id_i = dim_grade_tbl.dim_grade_id_i
and dim_grade_question_tbl.dim_level_id_i = dim_level_tbl.dim_level_id_i
</SQL>
</Query>
<Level name="Grade" column="grade_name_c" table="dim_grade_tbl" uniqueMembers="true"/>
<Level name="Level" column="level_name_c" table="dim_level_tbl" uniqueMembers="true"/>
</Hierarchy>
</Dimension>
使用sql查询也会得到同样的异常。
任何人都可以帮助我如何使用雪花模式获得多个级别?