From ee94c6081508b43933fb0d64c61b8850ac99f254 Mon Sep 17 00:00:00 2001 From: Eric Phillips Date: Thu, 21 Oct 2021 23:21:53 -0600 Subject: [PATCH] changing to a module usable by flaskfdx --- flaskfdx/tools/fdxsql.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/flaskfdx/tools/fdxsql.py b/flaskfdx/tools/fdxsql.py index 84cbe7e..df70e38 100644 --- a/flaskfdx/tools/fdxsql.py +++ b/flaskfdx/tools/fdxsql.py @@ -1,8 +1,8 @@ #!/bin/python """ process fdx excel files into existing sqlite3 database -usage fdxtools TYPE INFILE DATABASE where TYPE is the report type, ie dsw -INFILE is an excel file, DATABASE is an sqlite file +standalone usage fdxtools TYPE INFILE DATABASE where TYPE is the +report type, ie dsw, INFILE is an excel file, DATABASE is an sqlite file """ import sys @@ -29,7 +29,7 @@ def appendLedger(conn, table, values): c.execute('INSERT INTO {} VALUES ({})'.format(table, holders), values) conn.commit() -def extractValues(srcSheet, conn, reportDate): +def extractDsw(srcSheet, conn, reportDate): """ get dsw data from srcSheet and call appendLedger with values """ @@ -108,6 +108,7 @@ def getDate(srcSheet): def main(): # get filename and database rom cmdline parser = argparse.ArgumentParser() + parser.add_argument("type") parser.add_argument("inFile") parser.add_argument("database") args = parser.parse_args() @@ -127,7 +128,7 @@ def main(): if checkDate(conn, reportDate): print("we have already processed " + reportDate) else: - extractValues(srcSheet, conn, reportDate) + extractDsw(srcSheet, conn, reportDate) if __name__ == '__main__': main()