def main(): engine = getDbConnection('ORADEVIBCUST', asEngine=True, echo=False) dtls = mail.getEmailDetails('SENDTOMHRISTOV') dt = datetime.now().date() srcDir = '/home/users/mhristov/data/creditman' dstDir = '/home/users/mhristov/tmp/forexMarginChange' files = ['haircut_rates.dat', 'haircut_rates_ibca.dat', 'haircut_rates_nfa.dat'] #initial data population run only once # populateTableInitialData(engine, dstDir, files) # sys.exit() # copyFiles(srcDir, path, files) repo = git.Repo(dstDir) filesNew = getFilesContent(dstDir, files) filesOld = getCommittedFilesContent(repo, files) filesToCommit = [file for (file, df) in filesNew.items() if not df.equals(filesOld[file])] dfAllNew = None dfAllOld = None if len(filesToCommit) > 0: dfAllNew = pd.concat([filesNew[f] for f in filesToCommit]) dfAllOld = pd.concat([filesOld[f] for f in filesToCommit]) merged = mergeOldAndNew(dfAllOld, dfAllNew, dt) #Save changed files to the table forex_margin_changes and return dataframe with info to be send out toSendDf = updateTable(engine, 'forex_margin_changes', merged) #send out notification print(toSendDf) # sendNotification(dtls, toSendDf, dt) #Commit changed files commitChangedFiles(repo, filesToCommit, dt) else: print('Old files and new files are same. Nothing to commit')