def test_fact_table_struct(self):
        join_struct = ntd.generate_join_struct_for_fact_table("f_detail", self.metadata, "d_", "_id",
                                                              overrides={"lab_procedure_class_id": "procedure_class_id"},
                                                              filter_table=None)
        self.assertTrue(len(join_struct))
        self.assertEquals(3, len(join_struct))

        select_join_sql = ntd.join_tables_together(join_struct)

        print(select_join_sql)

        self.assertTrue(len(select_join_sql))


        self.connection.execute(select_join_sql)
    def test_join_tables_togehther(self):
        join_struct = [{"table_name": "main_table", "alias": "mt", "fields": ["a", "b", "c"], "field_aliases": {}},
                 {"table_name": "join_table", "alias": "jt", "fields": ["a", "x", "z"], "field_aliases": {"a": "a1"},
                 "join_criteria": {"join_table": "main_table", "join_table_field": "a", "join_to_table_field": "a"}
                 }
                ]

        join_sql = ntd.join_tables_together(join_struct)
        self.assertIsNotNone(join_sql)

        c = self.connection.execute(join_sql)

        result_set = list(c)
        print(result_set)
        self.assertEquals(2, len(result_set))