return the date out of a processing function
This commit is contained in:
@@ -1,6 +1,8 @@
|
|||||||
#!/bin/python
|
#!/bin/python
|
||||||
"""
|
"""
|
||||||
process fdx excel files into existing sqlite3 database
|
process fdx excel files into existing sqlite3 database
|
||||||
|
processREPORTNAME functions all expect a file and database connection
|
||||||
|
as arguments and return a date and error message if there is one
|
||||||
standalone usage fdxtools TYPE INFILE DATABASE where TYPE is the
|
standalone usage fdxtools TYPE INFILE DATABASE where TYPE is the
|
||||||
report type, ie dsw, INFILE is an excel file, DATABASE is an sqlite file
|
report type, ie dsw, INFILE is an excel file, DATABASE is an sqlite file
|
||||||
"""
|
"""
|
||||||
@@ -114,10 +116,10 @@ def processDsw(file, database):
|
|||||||
|
|
||||||
# check if records already exist and then add records if not
|
# check if records already exist and then add records if not
|
||||||
if checkDate(database, reportDate):
|
if checkDate(database, reportDate):
|
||||||
print("we have already processed " + reportDate)
|
return reportDate, "we have already processed " + reportDate
|
||||||
else:
|
else:
|
||||||
extractDsw(srcSheet, database, reportDate)
|
extractDsw(srcSheet, database, reportDate)
|
||||||
|
return reportDate, None
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
# get filename and database rom cmdline
|
# get filename and database rom cmdline
|
||||||
@@ -133,7 +135,11 @@ def main():
|
|||||||
sys.exit('database could not be opened, does it exist')
|
sys.exit('database could not be opened, does it exist')
|
||||||
|
|
||||||
if args.type == 'dsw':
|
if args.type == 'dsw':
|
||||||
processDsw(args.inFile, conn)
|
date, error = processDsw(args.inFile, conn)
|
||||||
|
if not error:
|
||||||
|
print(date)
|
||||||
|
else:
|
||||||
|
print(error)
|
||||||
else:
|
else:
|
||||||
print('type not found or not entered')
|
print('type not found or not entered')
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user