def main(): """ `read_local_tables()` accepts a "sqlite3.connection" object generated by `write_local_tables()` to minimize the number of SQLite connections. Otherwise, if `load.read_local_tables()` is called in isolation on the interpreter, a new SQLite connection is made. This function returns pandas.DataFrame objects for each of the three tables. """ #assert(Local_Connection is not None) # Marked for potential removal ''' try: del Imitmidx, Invloc, Bmprdstr, Sfdtlfil, imitmidx_sql, iminvloc_sql, bmprdstr_sql, sfdtlfil_sql gc.collect() gc.disable() except NameError: pass ''' Local_Connection = sqlite3.connect("/mnt/c/sqlite/099.db") imitmidx_sql = pd.read_sql("SELECT * FROM imitmidx_sql;", Local_Connection) iminvloc_sql = pd.read_sql("SELECT * FROM iminvloc_sql;", Local_Connection) bmprdstr_sql = pd.read_sql("SELECT * FROM bmprdstr_sql;", Local_Connection) sfdtlfil_sql = pd.read_sql("SELECT * FROM sfdtlfil_sql;", Local_Connection) # Dropping pesky "index" column of extra indices imitmidx_sql = imitmidx_sql.drop(columns=["index"]) iminvloc_sql = iminvloc_sql.drop(columns=["index"]) bmprdstr_sql = bmprdstr_sql.drop(columns=["index"]) sfdtlfil_sql = sfdtlfil_sql.drop(columns=["index"]) billOfMaterials, children = processing.main(imitmidx_sql, iminvloc_sql, bmprdstr_sql, sfdtlfil_sql) sysargForGenReport = False if sysargForGenReport: bom_report = Report.BOMReport(billOfMaterials, imitmidx_sql, iminvloc_sql, sfdtlfil_sql, bmprdstr_sql) bom_report.output() # Starts the cost-reporting functionality inventory = Report.Inventory(bom_Dataframe=billOfMaterials, bom_Dict=children) item = Report.Item.item breakpoint() return imitmidx_sql, iminvloc_sql, bmprdstr_sql, sfdtlfil_sql
def main(): """ For the impatient: import load, processing billOfMaterials = load.main() Process Flow: I. `main()` calls `database_tables()` to return three values (imitmidx_sql, iminvloc_sql, bmprdstr_sql) which are each pandas.DataFrame objects collected from locally-written copies of the Macola server A. `write_local_tables()` first removes 099.db file if already exists C. `write_local_tables()` calls `sqlite_connection()` to return a SQLite3 connection, assigned as "Local_Connection" in `main()` II. `main()` calls `read_local_tables()` passing the connection (from previous step) returning local copies of the SQLite data as pandas.DataFrame objects. III. `processing.main()` returns pandas.DataFrame object, called billOfMaterials, that is prepared mostly by `processing.get_children()` and its child function `processing.next_generation()`. """ """ Collect data with `database_tables() from Macola 099 database tables: imitmidx_sql, iminvloc_sql, and bmprdstr_sql, and store the results as pandas.DataFrame objects """ imitmidx_sql, iminvloc_sql, bmprdstr_sql, sfdtlfil_sql = database_tables() """ Call `write_local_tables()` to write pandas.DataFrame contents of "imitmidx_sql", "iminvloc_sql", and "bmprdstr_sql" as SQL-formatted data -- returning the SQLite connection """ Local_Connection = write_local_tables(imitmidx_sql, iminvloc_sql, bmprdstr_sql, sfdtlfil_sql) """ `read_local_tables()` accepts a "sqlite3.connection" object generated by `write_local_tables()` to minimize the number of SQLite connections. Otherwise, if `load.read_local_tables()` is called in isolation on the interpreter, a new SQLite connection is made. This function returns pandas.DataFrame objects for each of the three tables. """ imitmidx_sql, iminvloc_sql, bmprdstr_sql, sfdtlfil_sql = read_local_tables( Local_Connection) """ # Return to this BillOfMaterials = processing.main(imitmidx_sql, iminvloc_sql, bmprdstr_sql) return BillOfMaterials""" billOfMaterials, children = processing.main(imitmidx_sql, iminvloc_sql, bmprdstr_sql, sfdtlfil_sql) breakpoint() print(billOfMaterials) # Marked for removal #billOfMaterials, children = furtherProcessing.main(billOfMaterials, children, sfdtlfil_sql, bmprdstr_sql, imitmidx_sql, iminvloc_sql) sysargForGenReport = False if sysargForGenReport: bom_report = Report.BOMReport(billOfMaterials, imitmidx_sql, iminvloc_sql, sfdtlfil_sql, bmprdstr_sql) bom_report.output() # Starts the cost-reporting functionality inventory = Report.Inventory(bom_Dataframe=billOfMaterials, bom_Dict=children) item = Report.Item.item """