Exemplo n.º 1
0
 def __init__(self):
     args = Argument.get()
     self.db = Connection(args.driver, args.server, args.database, args.userid, args.password)
Exemplo n.º 2
0
        except Exception as err:
            Verbose.print_ln("Something went bad \nError: ", err)

        if first_run or db_updated:
            try:
                db_df.to_pickle('result.pkl')
            except Exception as err:
                Verbose.print_ln("Was not able to create new pkl file, Error:", err)
            self.create_or_update_view()
            Verbose.print_ln("update the view and the pkl")
        else:
            Verbose.print_ln('No changes, database table status remained same.')

    """ Documentation: create_or_update_view
       Description:
           a method used to create new view "vw_AllSurveyDataPython" and store all survey data we got from procedure object.
    """
    def create_or_update_view(self):
        procedure = Procedure(self.db)
        final_query = ' CREATE OR ALTER VIEW vw_AllSurveyData AS ' + procedure.get_all_survey_data()
        self.db.create(final_query)
        Verbose.print_ln("View updated.")


if __name__ == '__main__':
    args = Argument.get()
    Verbose.show_messages(args.verbose)

    starter = Starter()
    starter.main()