def test_get_selectable_by_table_name_for_single_table_query(self):
     '''
     test get selectable tables names from query
     '''
     query = Select([self.__test_fact_table.c.fact_asmt_outcome_vw_rec_id,
                     self.__test_fact_table.c.inst_hier_rec_id], from_obj=self.__test_fact_table)
     self.assertEquals({'fact_asmt_outcome_vw'}, set(get_selectable_by_table_name(query).values()))
Example #2
0
 def get_context_tables(self, query):
     '''
     Get a list of context tables from the query
     '''
     return {
         obj
         for (obj, name) in get_selectable_by_table_name(query).items()
         if name in (Constants.STUDENT_REG, Constants.FACT_ASMT_OUTCOME_VW,
                     Constants.FACT_BLOCK_ASMT_OUTCOME)
     }
 def test_get_selectable_by_table_name_for_multiple_table_join_query(self):
     '''
     test get selectable tables names from query
     '''
     query = Select([self.__test_fact_table.c.fact_asmt_outcome_vw_rec_id,
                     self.__test_dim_table.c.inst_hier_rec_id],
                    from_obj=self.__test_fact_table.join(
                        self.__test_dim_table,
                        and_(self.__test_fact_table.c.inst_hier_rec_id == self.__test_dim_table.c.inst_hier_rec_id)))
     self.assertEquals({'fact_asmt_outcome_vw', 'dim_inst_hier'}, set(get_selectable_by_table_name(query).values()))
 def test_get_selectable_by_table_name_for_single_table_query(self):
     '''
     test get selectable tables names from query
     '''
     query = Select([
         self.__test_fact_table.c.fact_asmt_outcome_vw_rec_id,
         self.__test_fact_table.c.inst_hier_rec_id
     ],
                    from_obj=self.__test_fact_table)
     self.assertEquals({'fact_asmt_outcome_vw'},
                       set(get_selectable_by_table_name(query).values()))
 def test_get_selectable_by_table_name_for_multiple_table_join_query(self):
     '''
     test get selectable tables names from query
     '''
     query = Select([
         self.__test_fact_table.c.fact_asmt_outcome_vw_rec_id,
         self.__test_dim_table.c.inst_hier_rec_id
     ],
                    from_obj=self.__test_fact_table.join(
                        self.__test_dim_table,
                        and_(self.__test_fact_table.c.inst_hier_rec_id ==
                             self.__test_dim_table.c.inst_hier_rec_id)))
     self.assertEquals({'fact_asmt_outcome_vw', 'dim_inst_hier'},
                       set(get_selectable_by_table_name(query).values()))
Example #6
0
 def get_context_tables(self, query):
     '''
     Get a list of context tables from the query
     '''
     return {obj for (obj, name) in get_selectable_by_table_name(query).items() if name in (Constants.STUDENT_REG, Constants.FACT_ASMT_OUTCOME_VW, Constants.FACT_BLOCK_ASMT_OUTCOME)}