learning the basics of Python, now ready for a bigger challange… it didn’t take long to stumble 🙂
I’m writing a basic allocation app that imports rows of “jobs” and then allocates each to a “contractor” based on contract conditions.
My first hurdle is, do i import the data directly into the db (using postgres) or into an object? I’m just a bit lost because the next step would then to parse the data for correctness… so should it be done once the data is stored or while in memory????
Steve
Loading data directly into any database should only be done if the data is reliable and trustworthy – so either from a backup or after being sanitized.
I would recommend reading your file in Python using either
csvor pandas – depending on how complicated the layout of the file is.You can then sanitize and parse the data and prepare it for the database.
Python provides a universal interface to all supported databases called the DB API. This wiki entry explains how to use it with Postgres.