Fifth Day

        Today I plan on further improving my script by adding the ability to work on multiple files in a folder. I also want to be able to format the information I have into "INSERT" queries for SQL. Another thing I could work on is just creating the tables for my Database.
        I figured out how to run my program in the Terminal.
python3 Test-CSV.py
This is the command I used to run it. The next thing I will work on is getting it in the right format to make the "INSERT" statements. 
        After lunch I decided to just make all of the tables that I would need for the database. I made the tables very quickly and easily. I am now working on making the script output "INSERT" statements. I almost have the precinct table part done.
        I had to rework the whole table, but I was able to finally make the insert statements work. I had to remove all spaces and commas as to not interfere with SQL syntax. Then to make sure it was correct I used a Query that would get the sum of every vote:
SELECT SUM(totalvotescast) FROM precincts WHERE ParentCounty != 'TOTALS';
        This gave me the correct value so I moved onto my next task, multiple files. I made it work with both files that I have in a new 'Data' folder. I had to import os in python for it to work. I am planning on adding another column with the name of the file so I can differentiate between the data sets while they are in the table together. I added issues to my repo so that I don't forget what I need to do later.

Comments

  1. It was great seeing you run the SQL statements on your database and get the results you were looking for yesterday. In today's (7/18) post, can you please provide a link to the github repository where your scripts are located? On Thursday I would like to run through your process myself to confirm that it is reproducible solely from your documentation.

    ReplyDelete

Post a Comment

Popular posts from this blog

First Day

Second Day