Simplifying Classes, Cleaner Interface

June 05, 2017

I did some restructuring today. Figured out that the best approach would be to keep all my main objects in the sps.py file.

So I deleted database.py and moved it into a Database class in the sps module.
I create a Scraper object and a Database object to use.
Now it’s a cleaner interface, yay.

import sps

scraper = sps.Scraper()

database = sps.Database()

report = scraper.inventory_report()

database.add_report(report)

Keep it as simple as possible, until I’m forced to bring in complexity.

Next steps is to figure out how to get the add_report (a wrapper around to_sql pandas method) method to use the already-defined schemas in models.py.

Right now, a schema is created based on the pandas dataframe, which is not ideal.