For each column in the piv_list, append ALL from_column's using the group_list
        e.g.
            Input Table
            YEAR    Person    Q1    Q2    
            2010    Fred    Spain   14
            2010    Jane    Spain   13.995
            
            Output Table
            Year    Person   Question    Result
            2010    Fred        Q1           Spain
            2010    Fred        Q2           14
            2010    Jane        Q1           Spain
            2010    Jane        Q2           13.995
            
            You would use:
                from_column  = [YEAR, Person]
                pivot_column = 'Question'
                piv_list     = [Q1, Q2]
                meas_names   = [Result]
                meas_values  = [Result]   # this can be SQL such as count(*) or count(distinct COL_NAME)
                
        To get the result:
            INSERT INTO C_UES2014_FT (
            YEAR, Person, Question, Result, REC_EXTRACT_DATE) (
            SELECT 
            YEAR, Person, 'Q1', Q1, SYSDATE 
                FROM S_UES2014_RAW);
            INSERT INTO C_UES2014_FT (
            YEAR, Person, Question, Result, REC_EXTRACT_DATE) (
            SELECT 
            YEAR, Person, 'Q2', Q2, SYSDATE 
                FROM S_UES2014_RAW);
            COMMIT;

def reverse_pivot_to_fact(self, staging_table, piv_column, piv_list, from_column, meas_names, meas_values, new_line):
        """
        For each column in the piv_list, append ALL from_column's using the group_list
        e.g.
            Input Table
            YEAR    Person    Q1    Q2    
            2010    Fred    Spain   14
            2010    Jane    Spain   13.995
            
            Output Table
            Year    Person   Question    Result
            2010    Fred        Q1           Spain
            2010    Fred        Q2           14
            2010    Jane        Q1           Spain
            2010    Jane        Q2           13.995
            
            You would use:
                from_column  = [YEAR, Person]
                pivot_column = 'Question'
                piv_list     = [Q1, Q2]
                meas_names   = [Result]
                meas_values  = [Result]   # this can be SQL such as count(*) or count(distinct COL_NAME)
                
        To get the result:
            INSERT INTO C_UES2014_FT (
            YEAR, Person, Question, Result, REC_EXTRACT_DATE) (
            SELECT 
            YEAR, Person, 'Q1', Q1, SYSDATE 
                FROM S_UES2014_RAW);
            INSERT INTO C_UES2014_FT (
            YEAR, Person, Question, Result, REC_EXTRACT_DATE) (
            SELECT 
            YEAR, Person, 'Q2', Q2, SYSDATE 
                FROM S_UES2014_RAW);
            COMMIT;        
        """
        self.sql_text += '\n-----------------------------\n--Reverse Pivot\n--------------------------\n\n'
        num_chars_on_line = 0
        for piv_num in range(len(piv_list)):
            # INSERT columns
            self.sql_text += 'INSERT INTO ' + self.fact_table + ' (' + new_line
            if piv_column not in from_column:
                self.sql_text += piv_column + ', '
                #pass
            for g in meas_names:
                self.sql_text += g + ', '
            
            for c in from_column:
                if c not in meas_names:
                    if c == piv_column: # dont insert the same column twice
                        print("Error - do NOT specify pivot column in the fact list")
                        exit(1)
                    else:
                        self.sql_text += c + ', '
                        num_chars_on_line += len(c) + 2
                        if num_chars_on_line > 100:
                            self.sql_text +=  new_line
                            num_chars_on_line = 0
            self.sql_text += '' + self.date_updated_col + ') (\n' 
                        
            
            # SELECT columns
            self.sql_text += 'SELECT '  + new_line
            num_chars_on_line = 0
            self.sql_text += "'" + piv_list[piv_num] + "', "
            for meas_num, _ in enumerate(meas_names):
                if meas_values[meas_num] == '':
                    self.sql_text += piv_list[piv_num] + ', '
                else:
                    self.sql_text += meas_values[meas_num] + ', '
                
            for c in from_column:
                if c not in meas_names: # dont insert the same column twice
                    self.sql_text += c + ', '
                    num_chars_on_line += len(c) + 2
                    if num_chars_on_line > 100:
                        self.sql_text +=  new_line
                        num_chars_on_line = 0
                
            self.sql_text += 'SYSDATE \nFROM ' + staging_table
            self.sql_text += ');\n'