1

我的表结构如下

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 查询也是我得到的相同异常。

谁能帮助我如何使用雪花模式获得多个级别?

4

0 回答 0