changing to a module usable by flaskfdx
This commit is contained in:
@@ -1,8 +1,8 @@
|
|||||||
#!/bin/python
|
#!/bin/python
|
||||||
"""
|
"""
|
||||||
process fdx excel files into existing sqlite3 database
|
process fdx excel files into existing sqlite3 database
|
||||||
usage fdxtools TYPE INFILE DATABASE where TYPE is the report type, ie dsw
|
standalone usage fdxtools TYPE INFILE DATABASE where TYPE is the
|
||||||
INFILE is an excel file, DATABASE is an sqlite file
|
report type, ie dsw, INFILE is an excel file, DATABASE is an sqlite file
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
@@ -29,7 +29,7 @@ def appendLedger(conn, table, values):
|
|||||||
c.execute('INSERT INTO {} VALUES ({})'.format(table, holders), values)
|
c.execute('INSERT INTO {} VALUES ({})'.format(table, holders), values)
|
||||||
conn.commit()
|
conn.commit()
|
||||||
|
|
||||||
def extractValues(srcSheet, conn, reportDate):
|
def extractDsw(srcSheet, conn, reportDate):
|
||||||
"""
|
"""
|
||||||
get dsw data from srcSheet and call appendLedger with values
|
get dsw data from srcSheet and call appendLedger with values
|
||||||
"""
|
"""
|
||||||
@@ -108,6 +108,7 @@ def getDate(srcSheet):
|
|||||||
def main():
|
def main():
|
||||||
# get filename and database rom cmdline
|
# get filename and database rom cmdline
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
|
parser.add_argument("type")
|
||||||
parser.add_argument("inFile")
|
parser.add_argument("inFile")
|
||||||
parser.add_argument("database")
|
parser.add_argument("database")
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
@@ -127,7 +128,7 @@ def main():
|
|||||||
if checkDate(conn, reportDate):
|
if checkDate(conn, reportDate):
|
||||||
print("we have already processed " + reportDate)
|
print("we have already processed " + reportDate)
|
||||||
else:
|
else:
|
||||||
extractValues(srcSheet, conn, reportDate)
|
extractDsw(srcSheet, conn, reportDate)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|||||||
Reference in New Issue
Block a user